response.statusText=“OK” but falls into error callback from ajax with jQuery

后端 未结 6 954
余生分开走
余生分开走 2021-01-13 16:16

Server side:

 ....
    $_SESSION[\'accountId\'] = $accountId;
    $_SESSION[\'type\'] = $_POST[\'accountType\'];
    echo \'1\';
    return;
<
6条回答
  •  Happy的楠姐
    2021-01-13 16:43

    Try omitting the return statement from server-side code. As far as your error callback is concerned, use the following generic ajax callback code and let us know what the status, responseText, and statusText properties are when this fails:

    function callback(response)
    {
      if (response.readyState == 4) 
      {
        if (response.status == 200) 
        {
          alert("Response Success:\n" + response.responseText);
        }
        else
        {
          alert("Response Error:\n" + response.statusText);
        }
      }
    }
    

提交回复
热议问题