标签:sha res fun 框架 document nts rip function script
表单//
@foreach($res as $k=>$v)
<tr id="{{$v->id}}" >
<td>{{$v->id}}</td>
<td >{{$v->tye}}</td>
<td fd="name" > {{$v->name}}</td>
<td><a href="#" class="shan" id="{{$v->id}}" >删除</a></td>
</tr>
//jqery
<script>
$(document).on("dblclick","td",function () {
fd=$(this).attr("fd");
id=$(this).parents().attr("id");
text=$(this).text();
that=$(this);
if (fd==undefined){
alert("不能修改")
}
html=$(this).html(‘<input type="text" class="gg" value="‘+text+‘">‘)
$(".gg").blur(function () {
new_val=$(this).val();
$.ajax({
url:"zt",
dataType:"json",
type:"get",
data:{
fd:fd,
id:id,
new_val:new_val
},
success:function (data) {
if (data==1){
that.html(new_val)
}
}
})
})
})
</script>
//控制器
function zt(req $req){
$fd=$req->get("fd");
$id=$req->get("id");
$new_val=$req->get("new_val");
$res= DB::table("ftyp")->where("id",$id)->update([$fd=>$new_val]);
return 1;
}
标签:sha res fun 框架 document nts rip function script
原文地址:https://www.cnblogs.com/azzy/p/11748759.html