Concurrent Connections with Ajax
Here’s an quick example of an ajaxed application with multiple connections.
You have your main page (lets say index.htm), when it loads it calls in various content using ajax
(lets say we call in navigation.php, products.php and basket.php).
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.
How do we get around this limitation? one way I’ve found that works pretty well is to put a delay in the ajax calls
“window.setTimeout(“ajaxcall()”, 400); ” for example.
(body onload would probably be the best option).
I’d be interested to hear other possible solutions.