Jump to content

Multiple AJAX requests.


girish.kc

Recommended Posts

Hi,

In my application, I'm using AJAX extensively. In some cases the page needs more than 2 ajax calls to get the required data. And some case, response from one call will be the input for other call.

I'm facing some delay problem wile dong the ajax call. If one response is delayed, the other will fail.

 

Any idea how to resolve this?

Is it a good idea to spun multiple AJAX calls one after other or combine them in a single call? which will be faster?

 

Thanks,

Girish

Link to comment
https://forums.phpfreaks.com/topic/239209-multiple-ajax-requests/
Share on other sites

if you can combine them then usually that's better. Which each AJAX call as you put it. You are making a separate request to the server. So if your server is under a lot of load or for some reason one query is slower than the other but one depends on the other then your going to suffer consequences. If you have FireFox i suggest a plugin/add-on called firebug.. get that enable it in firefox on your page then open it and what whats happening when your page is loading.

 

Also maybe your approach with your ajax is backwards maybe rewriting it to work mildly differently would be in favor. But in all less calls going to and from client to server the faster things will run. So in favor of speed all combined is my preferred choice as should be anyone's only time you go with more is if its absolutely imperative.

@monkeytooth: Thanks for the quick replay. I already have firebug installed for firefox. I will try to combine multiple requests. Right now the application is working fine [say 99%], but some times I'm facing the response delay problem. Anyway it is better to look into this, because it may fail at any time.

 

Thanks again for the suggestion.

Girish

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.