开发者

Progress Update Between Python and jQuery.ajax Call

I have two functions that I need to run, both take quite some time to complete. The second is dependent on the first, so they need to be in order. The first MUST be done with an ajax call to Python from JavaScript (using jquery.ajax). The second is some parsing and HTML generation, so it can be done in either JavaScript or Python.

I would prefer the second to be in Python since this would mean the "heavy lifting" is done server-side. However, I would like to notify the user that the first function is complete and the second one is running. The problem is the amount of data between the functions would not make sense to transfer from Python to JavaScript (server to client), then back to Python (client to server). It'd be much faster to keep everything on the server side until the second function is complete, then transfer what information I do have back to JavaScript (containing the HTML code).

Again, I would like to notify the user (through JavaScript) that the first Python function is complete and the second one is running. Then once the second one completes, the 开发者_JAVA百科data should be passed back to JavaScript to be displayed.


You can cut the python part in 2 functions and call first, then call 2nd when first is finished all with jQuery.ajax(...)

Or use HTML5 Web Sockets to discuss with server...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜