Problems with Asynchronous Ajax requests. I have an onload() function that calls a simple javascript method that just executes multiple ajax requests.
<script type='text/javascript'>
function search()
{
new Ajax.Request('/main/search/1', {asynchronous:true, evalScripts:true});
new Ajax.Request('/main/search/2', {asynchronous:true, evalScripts:true});
new Ajax.Request('/main/search/3', {asynchronous:true, evalScripts:true});
new Ajax.Request('/main/search/4', {asynchronous:true, evalScripts:true});
}
</script>
The problem is that when say the first request hangs, the other request pause and wait till the first request is finish. I was under the impression that the other requests would be fulfilled regardless since each request is a new request to the server. I need to be able to have a request sit and not affect the other request. I am using webbrick right now in development mode as my webserver. What am I doing wrong?
**UPDATE**
The HTTP/1.1 spec does not provide any guidelines on the ideal number of requests to pipeline. It does, however, suggest a limit of no more than 2 keep-alive connections per server.
People succeed in answering Don Miguel de los Platanos's questions 42% of the time (8 successes in 19 attempts).