一、jquery实现方法:
MessageAction.class.php页面代码如下:
display();
}
function add(){
//ajaxReturn(数据,'提示信息',状态)
$m=M('message');
if($m->add($_GET)){
$this->ajaxReturn($_GET,'添加信息成功',1);
}else{
$this->ajaxReturn(0,'添加信息失败',0);
}
}
}
?>模板index.html代码如下:
二、ThinkPHP实现方法:
MessageAction.class.php页面代码如下:
display();
}
function addtwo(){
$m=M('message');
if($vo=$m->create()){
if($m->add()){
$this->ajaxReturn($vo,'添加成功',1);
}else{
$this->ajaxReturn(0,'添加失败',0);
}
}else{
$this->error($m->getError());
}
}
}
?>模板index.html代码如下:
下一篇:ThinkPHP中的询语言有哪些