简体   繁体   English

ajax调用异步问题

[英]ajax call async issue

i just have a problem with the async mode. 我只是异步模式有问题。 in my ajax call i create a pdf, which takes a while (10 - 45 seconds) and in the success section of ajax i call window.open('path of pdf') to show the created pdf. 在我的ajax调用中,我创建了一个pdf文件,这需要一段时间(10-45秒),在ajax的成功部分中,我调用window.open('path of pdf')以显示创建的pdf。

my issues: 我的问题:

  1. When i call the ajax in the sync mode, the function dies in Safari and no popup appears. 当我在同步模式下调用ajax时,该功能在Safari中死亡,并且没有弹出窗口。 due to, the request tooks too long... 由于此请求花了太长时间...

  2. When i call it in the async mode, everything is fine but the popup blocker blocks the pdf. 当我在异步模式下调用它时,一切都很好,但是弹出窗口阻止程序阻止了pdf。 in the sync mode the popup appears, though the popup blocker is active. 在同步模式下,尽管弹出窗口阻止程序处于活动状态,仍会显示弹出窗口。

Check status with setInterval method every few second. 每隔几秒钟使用setInterval方法检查状态。

  • if status is creating show preloader 如果状态正在creating show preloader
  • if status is rejected show message about error 如果状态被rejected显示有关错误的消息
  • if status is created redirect to page that you want 如果状态已created重定向到所需的页面

What kind of popup blockers can block popups created by JS/HTML? 什么样的弹出窗口阻止程序可以阻止JS / HTML创建的弹出窗口?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM