Concurrent Connections with Ajax
Here is an quick example of an ajaxed application - you have your main page (lets say index.htm) and when it loads it calls in various content using ajax (lets say we call in navigation.php, products.php and basket.php). Ok so navigation.php, and products.php load fine but basket.php fails!! Hmmm, what a pain - why did it fail to load you ask. Simple!! most browsers can only handle 2 ajax calls at one time and because all 3 of them are called on the index.htm page load - then one probably will fail.
Ok, so how do we get around this limitation? well one way I’ve found that works pretty well is to put delay in the ajax calls ” window.setTimeout(”ajaxcall()”, 400); ” for example. You could have this in the tag or just simply enter the javascript at the end of the page (body onload would probably be the best option).
I’d be interested to hear other possible solutions.
No comments:
Post a Comment