I apologize if this is a duplicate.
Let's say I have a JavaScript function that calls a web service to pull some data. I use some kind of moving graphics so that the user knows that it works. When it is successfully restored, I change the graphics to a check mark. Here is my code:
getData: function() {
$("#button").attr("disabled", "true");
var params = {
doRefresh: false,
method: '/GetData',
onSuccess: new this.getDataCallback(this).callback,
onFailure: new this.getDataFailed(this).callback,
args: { text: $("#getData").val() }
};
WebService.invoke(params.method, params.onSuccess, params.onFailure, params.args);
}
What I need is after 5 minutes, if this process still could not successfully return my data, throw an exception, or, even better, run my this.getDataFailed (this) .callback function. Does this look like JavaScript? I looked at setTimeout () and setInterval (), and they seem to just delay the execution of the script, while I literally want to “time out” a long process. Any ideas?
, / , .