用这个方法把名叫editor的div层里面的所有内容值传递到PHP页面中。
HTML页面中:
var content = $('#editor').html();
$.ajax(
{
type: "post",
async:false,
dataType: 'html',
url: "../../Hospital/Manager/Lib/Action/AddAction.class.php",
data: "content="+content,
success: function(data)
{
if(data.info == "成功")
{
alert("传值成功");
}
},
error:function(data)
{
alert("失败");
}
}); 现在思路有点混乱,不知道该怎么处理下一步。其实就是想从HTML页面中把content里面的值取出来存到数据库中
php页面
<?php
// 本类由系统自动生成,仅供测试用途
class AddAction extends Action {
public function index()
{
$sql3 = M("Wenzhang"); // 实例化User对象
$NeiRong = I ('content');//I方法会自动检测是POST传递还是GET传递
$data['content'] = $NeiRong;
$result = $sql3->add($data);
if($result)
{
$this->success('成功');
}
else
{
$this->error('错误');
}
}
}怎么调用Index方法啊? 最佳答案