Peroidic callbacks using JQuery $.ajax and a web service to update progess on web client?
Hi, I'm making the following call to a WCF web service using JQuery ajax. This works but I was wondering if there is a way that you can alert the client with a callback function that certain points of the long process are complete instead of waiting for the success method to be called at the end.
Example:
"Step 1 complete"
"Step 2 complete"
"Step 3 processing"
Some suggestions I came across are: 1.) you could poll the process periodically on set intervals to check the progress or 2.) break up the long process into seperate $.ajax calls on the client and update the HTML progress on the client after each call.
But I'm more interested in making the callbacks. Thanks for any thoughts.
Current call that is working....
$.ajax({
type: "POST",
url: "/Secure/WCF/MyWebService.svc/SomeLongProcess",
data: MyJsonFormattedData,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
var result = msg.d;
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});