html代码:
$.ajax({
type:'get',
data:'user_name='+username+'&user_pwd='+password,
url:"
http://url.cn/accounts/checklogin_game
",cache: false,
dataType:'jsonp',
success:function(data){
alert(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status); //返回200
alert(XMLHttpRequest.readyState); //返回4
alert(textStatus); //返回parsererror
}
});
php代码
$arr ['msg'] = '对不起,用户密码错误!';
$arr ['state'] = '-2';
$arr ['info'] = 'login';
die ( json_encode ( $arr ) );
页面错误: