tp5单删

//接值

$res=Request::instance()->param(true);
$data=Db::table("user")->insert($res);
if(!empty($data)){

return 1;

}

//html页面

<a href="javascript:" onclick="one_del({$v.id})">删除

//js事件  get传值
function one_del(id)
{if(confirm("您确定要删除第"+id+"条吗?"))

{$.get("{:url('Title/del_do')}?id=" + id, function (data, status){if (data == 1) {
var tr = document.getElementById(id);
tr.remove();
location.href = "{:url('Title/show')}";
}public function del_do($id){
$res = Db::table('l_title')->delete($id);;
if($res){return 1;

$(".del").on("click",function(){
var tr = $(this).attr("id");

原文地址:https://www.cnblogs.com/gwhm/p/10188647.html