更新时间:2022-04-15 22:26:46
dataType: "json"
意味着:给我json,别无其他.一个空字符串不是json,因此接收到一个空字符串意味着它并不成功...
means: give me json, nothing else. an empty string is not json, so recieving an empty string means that it wasn't a success...
request = $.ajax({
type: "POST",
url: url,
data: {
....
},
error: function() {
console.log("error");
},
success: function(res) {
var response = jQuery.parseJSON(res);
if(typeof response == 'object'){
if(response.reply == '2') {
getResult();
}
} else {
//response is empty
}
}
});