I have an ajax that run in background..
var sTimeOut = function () {
$.ajax(
{
type: "POST",
url: '@Url.Action("checkJobIDs")',
dataType: "json",
async: true,
success: function (data) {
}
});
}
var interval = 10000;
setInterval(sTimeOut, interval);
Searching an element I want to stop that another ajax which runs in background.
$.ajax(
{
type: "POST",
url: '@Url.Action("searchData")',
dataType: "json",
mtype: "post",
data: { str: str },
async: true,
complete: function () { $(sTimeOut).hide(); },
success: function (data) {
search(data.searched[0]);
}
});
How can I prevent first ajax while working on 2nd ajax?