Home  >  Article  >  Backend Development  >  thinkphp3.2 uses ajax to delete columns and shares examples

thinkphp3.2 uses ajax to delete columns and shares examples

小云云
小云云Original
2018-03-14 11:16:061590browse

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

Use Tp to delete 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn