Delete thinkphp and thinkphp
1. cyclically traverse the id of the user to be deleted or the deleted article:
<Volist name = "list" id = "vo">
<Tr id = "sit _ {$ vo ['id']}">
<Td style = "text-align: center;"> <a class = "nspan" href = "{: U ('owner/OwnerInfo? Id = '. $ vo ['id'])} "> View Details </a> <a class =" nspan "href =" javascript: del ({$ vo ['id']}); "> Delete </a> </td>
</Tr> </volist>
2. Use js to submit the value of the id to be deleted to the background method.
<Script type = "text/javascript"> function Del (id) {var data = {id: id}; var setid = "sit _" + id; if (confirm ("are you sure you want to delete this user? ") {$. Ajax ({type: "POST", url: "{: U ('owner/delowner')}", data: data, dataType: "json", success: function (msg) {if (msg = 1) {alert ("deleted successfully"); $ ("#" + setid ). hide () ;}, error: function (msg) {}}}</script>
3. Define the background deletion method
public function DelOwner(){ $cuser=M('cuser'); $id=I('param.id'); $return='0'; if(!empty($id)){ if($cuser->where(array('id'=>$id))->delete()){ $return='1'; } } $this->ajaxReturn($return); }