时间:2021-07-01 10:21:17 帮助过:32人阅读
namespace PortalController;
use CommonControllerHomebaseController;
/**
首页
*/
class IndexController extends HomebaseController {
function postMessage(){
//$this->ajaxReturn($_POST,'添加信息成功',1);
//$this->success("注册成功!",__ROOT__."/");
$data=$_POST["name"];
//echo $data;
return $data;
// $this->assign("name",$data);
// $this->display(":index");
}
}
namespace PortalController;
use CommonControllerHomebaseController;
/**
首页
*/
class IndexController extends HomebaseController {
function postMessage(){
//$this->ajaxReturn($_POST,'添加信息成功',1);
//$this->success("注册成功!",__ROOT__."/");
$data=$_POST["name"];
//echo $data;
return $data;
// $this->assign("name",$data);
// $this->display(":index");
}
}
你ajax里的参数url写的不对吧,你那个__url__应该是一个变量,应该写成url: __URL__+"/postMessage", dataType参数不能注释
$.ajax({
url: __URL__+"/postMessage",
type: "POST",
data:{name:'name',tel:'tel',msg:'message'},//
dataType: "json",
error: function(){
alert('Error loading XML document');
},
success: function(data,status){//如果调用php成功
alert(data);
}
});