I am doing a cross domain Ajax call.
My Code:
if (window.XDomainRequest) // Check whether the browser supports XDR.
{
xdr = new XDomainRequest(); // Create a new XDR object.
if (xdr) {
xdr.timeout = 3000;//Set the timeout time to 3 second.
xdr.onload = function () {
alert("Success");
};
xdr.onerror = function () {
alert("Error");
};
xdr.ontimeout = function () {
alert("Error");
};
xdr.open("post", urlSearch);
xdr.send();
}
}
else {
$.ajax({
url: urlSearch,
type: 'POST',
dataType: 'json',
timeout: 3000,
success: function (data) {
alert("Success");
},
error: function () {
alert("Error");
}
});
}
The above code works fine in all browsers, but in IE sometimes it is showing an error like (aborted).
To overcome this error I searched in Google and did not find any good solution.
You can see the error message where (aborted) is showing. http://postimg.org/image/k01u6t9v5/
When I do individual call to a specific URL it is not showing any (aborted) message(Showing Success alert). But when I do multiple call (like in the image) its showing that type of error.
How to overcome this issue?
Please help
Thanks in advance