Question : AJAX with timer

Dear Experts! Please kindly help me in finding the solution for: I have an html page with a form within. Form is submitted with Mootools AJAX handler (www.mootools.net). I want to place  a function in OnComplete section which would be called each 1 second to another PHP script and waiting for the special response for it with resulting in log div and after receiveing special response exit. Please help!
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:

Open in New Window Select All

Answer : AJAX with timer

Following script demonstrates use of setInterval method.

If you submit a form,client is notifiead after server processed whole script. If your database actions run asynchronously independetly on original thread, you can use some kind of sleep/while loop in the  original server thread/script. So there will be no need of further AJAX request. Of course this is only aplicable if these operations take relative short amount of time.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:

Open in New Window Select All
Random Solutions  
 
programming4us programming4us