微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

post方式进行无刷新删除

js代码

$('.delete').click(function () {
        var that = $(this);
        if(confirm('您确定要删除')){
            var user_id = $(this).attr('user_id')
            $.post("/index.PHP/miniapp/automatic.content/deleteInfo",{'user_id': user_id},function (data) {
                if(data.code == 200){
                    that.parents('tr').remove();
                }else{
                    alert(data.msg)
                }
            });
        }


    })

控制器代码

/*
 * 删除审核内容
 * 微信:fangkangfk
 * time:2018.9.12
 * author:咔咔
 * */
    // 删除发布内容
    public function deleteInfo(){
        $userId = $this->request->param('user_id');

        $infometion = InfometionModel::where([
            'user_id'=>$userId
        ])->delete();

        $project = ProjectModel::where([
            'user_id'=>$userId
        ])->delete();

        $project = TemeModel::where([
            'user_id'=>$userId
        ])->delete();

        $data['examine'] = 3;
        $status = AutomaticModel::where([
            'id'=>$userId
        ])->update($data);

        if($infometion && $project && $project){
            $send = ['code'=>200,'msg'=>'删除成功'];
        }else{
            $send = ['code'=>400,'msg'=>'删除失败'];
        }
        return json($send);
    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐