Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.