I am beginner to jquery ajax. My below ajax code was working fine when I was using async: false
, but due to problems in firefox I removed it after referring this link(I was facing the same issue). Now it is not working. not even showing any errors.
Here is my code:
try {
_ajaxCall = $.ajax({
url: URL,
type: "POST",
data: "drqlFragment=" + text,
//async : false,
cache: false,
headers: {
accept: "application/json",
contentType: "application/x-www-form-urlencoded"
},
contentType: "application/x-www-form-urlencoded",
//processData : true,
success: function (data, textStatus, jqXHR) {
var resData = data.suggestions;
for (var i = 0; i < resData.length; i++) {
sugData.push(resData[i].keyword);
}
},
error: function (response) {
//Error here
alert('hello');
}
});
} catch (e) {
alert(e);
}
The above code is neither executing success
nor error
. I even tried to catch the error by keeping try catch
block but no use.