views:

36

answers:

2

Let's say I have a line of code that looks like this:

setInterval(ajaxFunction,3000);

where ajaxFunction is a function that calls a PHP script and returns something. If this request happens to take longer than 3 seconds, what happens? will It terminate the current request and start over, or will it start a 2nd request and have both running at once? (or some other behavior I haven't thought of)

+1  A: 

They will overlap. Your second ajax call will begin before the first one completes.

g.d.d.c
+2  A: 

They will overlap. Rather than setInterval, you could use setTimeout and set it within your oncomplete handler within the ajaxFunction.

Rob