Closed lgrkvst closed 10 years ago
Hi I googled 'jquery ajax progress' and came across this gist: https://gist.github.com/db/966388 I liked best the shortest solution: adding xhrFields to the $.ajax-call like this:
jquery.soap.js line 222:
return $.ajax({
type: "POST",
url: options.url,
async: options.async,
headers: options.headers,
// crossDomain: true,
dataType: "xml",
processData: false,
data: this.toString(),
- contentType: contentType + "; charset=UTF-8"
+ contentType: contentType + "; charset=UTF-8",
+ xhrFields: {
+ onprogress: function(e) {
+ if (e.lengthComputable) {
+ log("jquery.soap - progress:", (e.loaded / e.total * 100));
+ } else {
+ log("jquery.soap - progress:","Length not computable.");
+ }
+ }
+ }
});
Should be able to do something with this? Does it work in your case? (make sure you set enableLogging true
to see these logs) If it works I can look into implementing it in jquery.soap.js!
btw: In my testbed it was only triggered once at 100% progress...
When I was using jquery.soap on a project, I just set the mouse cursor to an hourglass right before making the soap call, and then had the callback function set the cursor back to normal. That gave a nice visual cue that something was happening in the background. I think that most soap calls are going to end up jumping from from 0 to 100 "progress".
On Mon, Apr 14, 2014 at 6:43 AM, Remy Blom notifications@github.com wrote:
btw: In my testbed it was only triggered once at 100% progress...
— Reply to this email directly or view it on GitHubhttps://github.com/doedje/jquery.soap/issues/44#issuecomment-40357130 .
I tried with a 'slower' call and found out that in that case it ends up in the !e.lengthComputable part of the script...
...only triggered once...
I am about to close this issue since it is going to be a no-go at the moment... Maybe in the future, but not now.... (I'll keep the above code in my personal version so it will be included in a future release and maybe we see this working properly in our future browsers some day...)
Thanks for your effort. And the great work!
/ Christian
Hi,
This plug really saved my day. Everything is working like a charm! Thanks a lot and good work.
I thought I'd add a progress bar as finishing touch. Can't get it to work though: I'm unable to start the progress bar from within the $.soap call, as beforeSend doesn't seem to execute my DOM alterations.
I also gave it a try using pace.js (http://ortheme.com/pace-automatic-page-load-progress-bar/). Same thing...
Any insights?
Again, thanks for a great plug!