views:

14

answers:

1

Suppose user requests an action, the page is equipped with ajax so the request has been made through javascript and the status of task are updating every 10 seconds. The problem is if the user close the page at this time the task would be lost? I want the php request, continue and complete even if the user closed the page.

How can I do that?

A: 

It's tough to be sure without a more intimate explanation. You may need to investigate cronjobs though, this is typically a server specific task in which set up depends on the kind of server you're running. If you have an admin control panel through your host it may have a section for setting up such tasks.

At the very least you could potentially detect partially finished work and then finish it up after a certain amount of inactive time from the user.

The other possibility is to simply do that check every page refresh, this would be server independent, but relies on being able to unreliably finish half-done tasks whenever a page is refreshed instead of guaranteeing it gets cleaned up at a specific time.

M2tM