标签:hone success json code rip turn blog color his
ajax代码
<script>
$(".onedel").click(function(){ if (!confirm("确认要删除?")) { window.event.returnValue = false; }else { var id = $(this).attr("data-id"); $.ajax({ url: "{:U(‘Phone/ajaxOnedel‘)}", type: "post", dataType: "json", data: {id: id,table:‘email_p‘}, success: function (data) { if (data.id == 1) { alert("删除成功"); window.location.href=("{:U(‘Phone/remail‘)}"); } } }) } });
</script>
控制器函数代码
public function ajaxOnedel(){ $table = I("post.table"); $map[‘readers‘] = $_SESSION[‘login‘]; $map[‘emailid‘] = I(‘post.id‘); $data[‘statuss‘] = -1; $res = M("{$table}")->where($map)->save($data); if( $res ){ $this->ajaxReturn(array(‘id‘ => 1 )); } }
标签:hone success json code rip turn blog color his
原文地址:http://www.cnblogs.com/wlbkphp/p/6538627.html