Jump to content

Stopping AJAX/PHP loop on window refresh/close


townclown

Recommended Posts

Hi,

 

I have an ajax function that calls a php script which loops until data in a database changes and returns xml to the ajax function -> which then calls itself again. Works a charm, but, if you refresh the page while the loop is running it takes AGES to reload. I assume the PHP script is waiting to timeout?

 

I added a button which calls a function to stop the loop(will not get into it but it stops the PHP loop using session variables), after which you can refresh and the page reloads swiftly.

 

Is there anyway i can call that function when the user refreshes the page - my php is 10 times better than my javascript im afraid.

 

Thanks in Advance.

Darren

Then it is not an AJAX Problem as abort() stop the connection thus stops the php if you are constanly reloading via AJAX try using a IFrame and add an out refresh to the code it would use so mutch less processing power allso the more javascript you use slower your site becomes

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.