• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

simultaneous ajax requests

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
good day,
i send an ajax request. before i get the response for that request, i make another request. i receive the response of the second, but not the first.
so to solve this problem, i have called the javascript function that contains the second ajax request, from the response of first request. by this way, we could avoid the second request being made, before the first response.

sequence of steps that created problem

1. ajaxrequest1 -------------->server
2. ajaxrequest2 -------------->server
3. ajaxresponse2 <-------------server


end

my solution

1. ajaxrequest1 -------------->server
2. ajaxresponse1(call javascript function that makes 2nd request) <-------------server
3. ajaxrequest2 -------------->server
4. ajaxresponse2 <-------------server


end

but this somehow, i think, limits ajax's power. is there any other solution.

have a great day,
krishna prasad g
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without seeing your code sounds like you are using global variables to hold the request object. When you make the second request you write over the first.

Eric
 
krishna prasad gunasekaran
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thankyou eric,
You are right! global variable is the issue.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Libraries such as jQuery and Prototype make it easy to create Ajax requests without the need for global variables.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic