在我的ajax .error函数中,我试图从例如从我正在获取的API发送回的responseText中获取值
{"error":"Wrong Crendtials","error_description":"Provided username and password is incorrect"}
在我的JavaScript中,它识别出错误,但是我无法理解要根据错误响应显示消息的各个项目吗?
).error(function (xhr,status,err) {
var errordata = xhr.responseText;
if (errordata != null) {
alert("has errors");
alert("error - " + errordata.error + " - desc " + errordata.error_description);
}
});
我确定这确实是最基本的东西,但是我正在努力寻找一个答案,使我无法理解这些价值观?
谢谢