我正在使用JQuery版本1.11.3,并且在每次成功响应之后,ajax调用仅转到.fail方法。我希望成功响应.done函数。我的回答是200 OK
$.ajax({
type: "get",
url: "/contactslist/"+selectedoption,
headers: {'cache-control': 'no-cache'},
json: true,
}).done(function(data) {
console.log("Successs: "+JSON.stringify(data));
})
.fail(function() {
console.log("Failed: ");
});
答案 0 :(得分:0)
更改JQuery版本
$(document).ready(function(){
jQuery.ajax({
type: "GET",
url: "populateData.htm",
dataType:"json",
data:"userId=SampleUser",
success:function(response){
if (response.redirect) {
window.location.href = response.redirect;
}
else {
// Process the expected results...
}
},
error: function(xhr, textStatus, errorThrown) {
alert('Error! Status = ' + xhr.status);
}
});
});