Ajax returns readyState of 0?

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

clipboard.png

ask why the readyState return status code is 0 uninitialized and not sent to the request. What should I do?

Mar.28,2021

see if access to the external network is restricted by intranet users


add these two parameters to OK

async: false, // 
timeout: 50000, //:50

in fact, colleagues use the form tag, or just remove the tag from the form form

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea7baa-47c35.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea7baa-47c35.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?