Jump to content


Photo

Parallel script execution + AJAX


  • Please log in to reply
2 replies to this topic

#1 e11even

e11even
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 02 July 2006 - 12:38 AM

Hi all,

I'm trying to develop an application that at some point needs to test a SSH connection to some hosts. I'm using AJAX to perfom the test by making a request to a script < testConnection.php >. Since this can take a while, I wanted to provide the user with some kind of progress indication.

In my approach, as < testConnection.php > runs, I put some status messages in the $_SESSION variable. Meanwhile, in the client side, i make several successive Asynchronous calls to another script < checkStatus.php > that returns the messages stored in $_SESSION.

The problem is that < checkStatus.php > will not run until < testConnection.php > has finished running and therefore it will display all the messages at once :(

Can someone please help me on getting this to work or suggest another approach in order to achieve this "progress indicator" result?

Thank you in advance,


#2 heckenschutze

heckenschutze
  • Members
  • PipPipPip
  • Advanced Member
  • 257 posts
  • LocationAustralia

Posted 02 July 2006 - 12:59 AM

Why don't you have 'testConnection.php' update a cookie it self as it goes along, and have your text page, read from the cookie every so often (using javascript) ?

#3 e11even

e11even
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 02 July 2006 - 09:37 PM

Hi,

Thanks for the tip, I tried it but it didn't work cause the cookie is set only after < testConnection.php > starts outputting some contents and that's in the end of the script. I'm I missing something or theres anyway to force the update of the cookie before the script ends? Some way of "flushing" the headders?

Thanks once again,




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users