Home > Article > Backend Development > thinkphp3.2 uses ajax to delete columns and shares examples
This article mainly shares with you examples of using ajax to delete columns in thinkphp3.2. I hope it can help you.
1. Problems encountered
(1) The data data of $.post cannot be placed in the URL for transmission, otherwise it will be equivalent to the get method
(2) The data obtained by ajax cannot be returned directly. You need version 3.2 to use ajaxReturn
$this->ajaxReturn ($data);
(3) There is no way to add return parameters in the custom function of html because $vo.id## cannot be used. #
$vo['id']Second solution(1)javacript:; is not operated by default(2)setTimeout indicates the code code delay time
删除
$('.del').click(function(){ var did=$(this).attr("data-id"); var url="{:U('Daily/dailyQuestionDel')}"; $.post(url,{id:did},function(data){ if(data.status == 1){ layer.msg(data.msgs); var t=setTimeout("location.href = location.href",500); }else{ layer.msg(data.msgs); var t=setTimeout("location.href = location.href",500); } }); });Related recommendations :
ThinkPH implements code sharing for batch deletion of columns
How to delete columns in ThinkPHP?
The above is the detailed content of thinkphp3.2 uses ajax to delete columns and shares examples. For more information, please follow other related articles on the PHP Chinese website!