Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AJAX question 1

Status
Not open for further replies.

tyreejp

Programmer
Apr 20, 2005
114
US

Hey all-

If I kick off an ajax polling script that hit the server every 30 seconds or so... would it continue to run if a user browsed to another page on the site?

--
James
 
I think it depends on where the "every 30 second" call is happening.

If it's in the JS, then it will stop, but if it's being called on the server, it will keep going.

TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
 
So, if it's server side JS (myscripts.js), then it'll keep going?

--
James
 
Javascript is downloaded to and run on the client machine. So if you are repeating the call in the javascript every 30 seconds it will stop calling as soon as the user leaves the page (closes the browser, clicks on a link, types in a new address).

If your JS is calling a script on the server (PHP, ASP, C#,..etc) and the server script that is running in the background is doing the 30 second call then it will keep running in the background until it either times out or you phyically go on the machine and kill the process.

TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top