girish.kc Posted June 13, 2011 Share Posted June 13, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/239209-multiple-ajax-requests/ Share on other sites More sharing options...
monkeytooth Posted June 13, 2011 Share Posted June 13, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/239209-multiple-ajax-requests/#findComment-1228961 Share on other sites More sharing options...
girish.kc Posted June 13, 2011 Author Share Posted June 13, 2011 @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 Quote Link to comment https://forums.phpfreaks.com/topic/239209-multiple-ajax-requests/#findComment-1228965 Share on other sites More sharing options...
monkeytooth Posted June 13, 2011 Share Posted June 13, 2011 no problem, and yea, squash the little things when you can as soon as you can, you never know when it may become a much larger issue in the future. Quote Link to comment https://forums.phpfreaks.com/topic/239209-multiple-ajax-requests/#findComment-1228982 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.