为什么提示后端判断为GET提交 求解
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<script type="text/javascript">
document.addEventListener('plusready', function(){
var xhr = new plus.net.XMLHttpRequest();
xhr.onreadystatechange = function () {
switch ( xhr.readyState ) {
case 0:
alert( "xhr请求已初始化" );
break;
case 1:
alert( "xhr请求已打开" );
break;
case 2:
alert( "xhr请求已发送" );
break;
case 3:
alert( "xhr请求已响应");
break;
case 4:
if ( xhr.status == 200 ) {
alert( "xhr请求成功:"+xhr.responseText );
} else {
alert( "xhr请求失败:"+xhr.readyState );
}
break;
default :
break;
}
}
xhr.open( "POST", "URL/控制器" );
xhr.send("class=3");
}, false );
</script>
</head>
<body onload="onload();">
</body>
</html>
后端控制器判断提交方法
if($_POST){
echo 1111;
}else{
echo 222222;
}
返回的是:222222
0 个回复