0

Currently I am doing a jQuery post to fetch some data from the server. In standard circumstances a large JSON is returned.

The first time this call runs it requires a large amount of processing time, (I've seen up to 15 minutes. We do have plans to create worker processes to build these behind the scenes and relay progress to the client) after the processing has completed we store this in a cache and return the JSON to the user.

In both scenarios we return exactly the same JSON to the client, the only difference being, if the cache is built it is returned in a few milliseconds, if the cache is not built, it can take a long time for the client to receive the response.

When this is running on the server, if the requests takes a long time the client never receives the ajax response but the server does complete the process (access logs show 200 statusCode) and store the cache. For reference on my localhost the ajax response is always received, regardless of time (or so I have seen thus far).

In a nutshell, we make a ajax post, if it takes a long time, the post response is never received and ends up waiting indefinitely.

This sounds like it is either a PHP or server side setting, but I can't seem to find the issue.

Any ideas or help are much appreciated.

4

1 回答 1

0

听起来您需要增加 ajax 请求的超时时间?

timeout 是基本 jquery ajax 方法的一个选项 - http://api.jquery.com/jQuery.ajax/

于 2011-05-31T08:16:22.930 回答