前端代码:
$.ajax({
type: "post",
async: true,
url: "{:U('Inboundshipmentplan/updateRemark')}",
data: {'id':id,'remark':remark},
dataType: "json",
success: function(data){
if(data.status==200){
layer.msg(data.msg, {icon: 6});
parent.location.reload();
} else {
layer.msg(data.msg, {icon: 5});
}
}
});
后台代码:
public function updateRemark() {
$id = trim(I('post.id'));
$remark = trim(I('post.remark'));
if ($id && $remark) {
$planModel = M('inbound_shipment_plan', 'fba_', 'DB_FBAERP');
$re = $planModel->where("id = $id")->setField('remark', $remark);
if ($re) {
$msg = array(
'status'=>200,
'msg' =>'操作成功'
);
}else{
$msg = array(
'status'=>500,
'msg' =>'操作失败'
);
}
} else {
$msg = array(
'status'=>500,
'msg' =>'数据有误'
);
}
$this->ajaxReturn($msg);
}