Jump to content

Simultaneous AJAX requests


smani

Recommended Posts

Hello.

I am trying to make two AJAX requests work simultaneously, a very simplified code is the following:

Server side:

Code:

session_start();

function abort(){
    $_SESSION['abort']=true;
}

function someTask(){
    while(workToDo=true && $_SESSION['abort']==false){
        do_some_task();
    }
}

Client side:

Code:

<script type="text/javascript">

new AJAXRequest().GET('page.php?task=someTask',callbackfz);
abortBtn.onclick=function(){
new AJAXRequest().GET('page.php?task=abort',callbackfz);
}
</script>

Now, it seems as if the webserver only processes the requests sequentially, i.e. the abort request is only processed once the someTask request has completed... Firefox should allow up to 6 simultaneous http connections with a server, is it therefore a problem/limitation with apache / php ? Also I was wondering, should the AJAX calls be indeed processed simultaneously, are session variables dynamic inside the php instance? I.e. if another instance changes a session variable, will it also be changed immediately in any other running instance?

 

Thanks for any inputs!

smani

Link to comment
https://forums.phpfreaks.com/topic/157142-simultaneous-ajax-requests/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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