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

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

Server side:

 ....
    $_SESSION[\'accountId\'] = $accountId;
    $_SESSION[\'type\'] = $_POST[\'accountType\'];
    echo \'1\';
    return;
<
6条回答
  •  灰色年华
    2021-01-13 16:41

    in your php code, use json_encode to return the response

    eg:

    $response = array('success'=>1);
    echo json_encode($response);
    

    then in your ajax success function it should be

    if (response.success == 1) { alert('success'); }
    

提交回复
热议问题