0

I have a page where I'm trying to use Jquery's $.get() to make a call to a long running import script. In this script it updates a database with how far through the process it is (i.e. 2%, 4% etc). I have another $.get() call (to check on the progress) which is setup through a setTimeout before the first $.get() is fired.

The problem I'm having is the $.get() call to check on progress never returns until the long running import $.get() returns. This doesn't seem to be right as they should be async.

As far as I can see the "check progress" URL is hanging if I launch it in a new tab within firefox, but if I load this in Chrome it returns instantly. As far as I know firefox should be able to run more than 1 AJAX call per hostname without a problem.

In Chrome with the developer tools enabled I see the "check progress" URL call as "pending" until the first one completes.

How can I get both requests to run async?

4

1 回答 1

1

你使用会话吗?如果是这样 - 虽然您没有在长脚本中关闭会话,但其他人会等待它。

如果你不需要一直在那里会话 - 你可以关闭它session_write_close()

这是我其他答案的完整副本https://stackoverflow.com/a/6405685/251311

于 2013-05-17T00:17:17.717 回答