开发者

How to get live results with jquery?

I make different queries with PHP and jQuery and I get the results with .ajax(),when all queries return their values.

What I want to do is to get those values as soon as they are ready. Now user has to wait until all the queries are done, but the first query returns its value 30 seconds before the second one, so I don't want the user to wait to see all开发者_JAVA百科 results at once, I want them to see the result just the result returns.

How can I do this?


If you are waiting for multiple database queries to return, you may consider breaking up your web services into multiple AJAX calls. In other words, make 2 AJAX requests, one for the first query and another for the second query (which gets its value 30 seconds after the first). That way you can return the first query back to the page and display it - or whatever needs to be done - while waiting for any additional AJAX calls.

Of course you can extend this technique to additional AJAX requests as needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜