Stop Ajax Call
Stop Ajax Call
Hi, is it possible to stop or interupt a jquery ajax call that's taking a long time? I'm using this for my call
-
$.ajax({
type: "POST",
url: $ws.url,
data: soapBody,
beforeSend: function(xhr) {
xhr.setRequestHeader("Content-Type", "text/xml");
$("#serviceResponse").val("");
$("#serviceBtnInvoke").attr("disabled", true);
$("#serviceResponseLabel").show().css({color: "#999"});
$("#serviceResponseLabel").val("Response: 0.000s");
},
complete: function(XMLHttpRequest, textStatus) {
response = XMLHttpRequest.responseText;
$("#serviceResponse").val(response);
$("#serviceBtnInvoke").removeAttr("disabled");
if (response.indexOf("faultcode") < 0 && response.toLowerCase().indexOf("xml") > 0) {
strColor = "#2c9f2c"
} else {
strColor = "#df533b"
}
$("#serviceResponseLabel").show().css({color: strColor});
}
});
I want to add a "Stop" button for web services that take a really long time to respond. Is there a method out there to kill the request?
Thanks for the help!
Mike