var xhr=new plus.net.XMLHttpRequest();
xhr.onreadystatechange=function(){
switch ( xhr.readyState ) {
case 4:
if ( xhr.status == 200 ) {
console.log("xhr请求成功:"+xhr.responseText);
} else {
console.log("xhr请求失败:"+xhr.responseText);
}
break;
default :
break;
}
};
xhr.open( 'POST', 'http://testapp.hooup.cn/sps/salesman/login.do' );
xhr.setRequestHeader('Content-Type','application/json');
var data = {'mobile':'6012','pwd':'6012'};
xhr.send(JSON.stringify(data));
返回的内容为:
xhr请求失败:<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
使用的时直接用的运行在真机 上调试
1 个回复
MANSOUL (作者) - 新鲜感最重要
问题已解决,确实可以跨域。