smani Posted May 6, 2009 Share Posted May 6, 2009 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 More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 Try putting the other function in another file. Link to comment https://forums.phpfreaks.com/topic/157142-simultaneous-ajax-requests/#findComment-828260 Share on other sites More sharing options...
smani Posted May 7, 2009 Author Share Posted May 7, 2009 Found the problem: when using session variables, PHP by default only allows sequential processing of requests accessing variables of a same session, cfr http://ch2.php.net/manual/en/ref.session.php#64525 . Link to comment https://forums.phpfreaks.com/topic/157142-simultaneous-ajax-requests/#findComment-828292 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.