开发者

ajax call with jquery - parsing incoming feedback data

I got a server-side script that I call with jQuery ajax method. It can take quite a while for it to process data set. After each row of input data is processed, it prints out a "OK <row id>" to output. The content type is plain/text.

What I want is to get this output in my jquery function, parse it as it comes and display some kind of feedback information to the user. As it can take up to 20-30 minutes to process all the data...

How can I do this in jQuery (the server script prints this out alredy). If I use the code below, I get the success function called after the script finishes its run.

$.ajax({
 type: "POST",
 url: "script.cgi",
 data: data,
 success: function() { 
   // do something
   alert ("OK");
 }
开发者_运维问答});


You can't accomplish what you want with a single Ajax call. You will need some server-side interaction (storing the progress in a database or in the session) and then poll the server to get the status.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜