AJAX向THINKPHP发送数据 THINKPHP怎么老是收不到数据
JS端$.post("<{:U('Index/editOrder')}>",{name:"zhangshan",age:"32"},function(a,b){alert...
JS 端
$.post(
"<{:U('Index/editOrder')}>",
{name:"zhangshan",
age:"32"},
function (a,b) {
alert(a);
alert(b);
}
);
PHP端
public function editOrder (){
if( isset($_POST) ) {
var_dump($_POST);
} else {
$this->display();
}
}
PHP那边老是提示POST为空 展开
$.post(
"<{:U('Index/editOrder')}>",
{name:"zhangshan",
age:"32"},
function (a,b) {
alert(a);
alert(b);
}
);
PHP端
public function editOrder (){
if( isset($_POST) ) {
var_dump($_POST);
} else {
$this->display();
}
}
PHP那边老是提示POST为空 展开
展开全部
$.post("<{:U('Index/editOrder')}>",
{
name:"zhangshan",
age:"32"
},
function(a,b){
alert(a);
alert(b);
});
确定下<{:U('Index/editOrder')}>这个url是否完整,目录是否正确;
php端 返回参数要遵循你ajax里面两个参数;其实网上的连个参数一个是状态,一个是数据,个人建议可吧两个参数合并到json返回;变成date,然后写date.a ,date,b;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询