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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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