request ajax to report an error, and XMLHttpRequest object returns readyState:0, status:0
related codes
function login(){
var phone = "18600000000";
var password = "123456";
var serverurl = "http://apiym.xnsoft.net.cn/ApiInterface.ashx?action="
console.log("--" + phone);
console.log("--" + password);
$.ajax({
type:"POST",
url:serverurl + "MemberLogin",
dataType:"json",
data:{
"Phone": phone,
"Pwd": password,
"PwdType": 0
},
success:function(ret){
console.log(JSON.stringify(ret));
},
error:function(XMLHttpRequest, textStatus, errorThrown){
console.log("XMLHttpRequest--"+JSON.stringify(XMLHttpRequest));
console.log("textStatus---"+JSON.stringify(textStatus));
console.log("errorThrown--"+JSON.stringify(errorThrown));
}
})
}
returns the following error message:
XMLHttpRequest--{"readyState":0,"status":0,"statusText":"error"} at login.html : 228
textStatus---"error" at login.html : 229
errorThrown--"" at login.html : 230
ask why the readyState return status code is 0 uninitialized and not sent to the request. What should I do?