开发者

Closing a page showing and handling a task with ajax

Suppose user requests an action, the page is equipped with 开发者_StackOverflow社区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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜