douke7274 2012-01-10 06:21
浏览 120
已采纳

jquery ajax多个请求

I've made a long-polling like a request in a function using jQuery ajax, which will run all the time. There is another request made to send data to PHP back-end file and this second request is not long-polling, it just sends data to that PHP file.

Problem: I examined with Firebug that when the long-polling request is running, I'm not able to send another request as long as the long-polling is running. How do I send another request even if the long-polling is running?

Note: I've used async: true in both.

another question: how do I make sure that even the function which holds long-polling request code will be called multiple times, but the long-polling request will be made only and only one?

  • 写回答

3条回答 默认 最新

  • douan6815 2012-01-10 07:17
    关注

    Does your php use session based authentication? Your problem might be session locking. This can occur in PHP that uses session_start() unconditionally at the top of each request, and is sometimes default behavior in an MVC framework even if the session is never modified. Other suspect use cases is if both scripts depend on being logged in as an admin user.

    If you suspect this might be the case, try strategic placement of session_write_close() at the earliest possible point after you no longer need to modify session data for your two scripts.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器