weixin_33704234 2016-03-16 15:29 采纳率: 0%
浏览 43

jQuery AJAX中断“错误”

I have a .php script that takes very long to complete (anywhere from 30 to 160 seconds).

From a webpage I am able to run this script using the JQuery $.ajax() function. However, if I try to leave the page while the ajax request is in progress the function throws an error 'error', which I alert().

I was wondering however if the .php script continues? Because for my case it doesn't really matter if the webpage doesn't receive the response, as long as the .php script doesnt stop halfway trough.

So: if an $.ajax() is interrupted, does that .php script finish non-the-less?

  • 写回答

1条回答 默认 最新

  • weixin_33725515 2016-03-16 15:32
    关注

    It is possible to let the script run after closing the connection:

    http://php.net/manual/en/function.ignore-user-abort.php

    You might want to look into job queues if you have long running scripts which do background tasks.

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料