zoukankan      html  css  js  c++  java
  • ajax使用

     /** 删除员工绑定点击事件 */
                $("#delete").click(function(){
                    /** 获取到用户选中的复选框  */
                    var checkedBoxs = boxs.filter(":checked");
                    if(checkedBoxs.length < 1){
                        $.ligerDialog.error("请选择一个需要删除的部门!");
                    }else{
                        /** 得到用户选中的所有的需要删除的ids */
                        var ids = checkedBoxs.map(function(){
                            return this.value;
                        })
                        
                        $.ligerDialog.confirm("确认要删除吗?","删除部门",function(r){
                            if(r){
                                // alert("删除:"+ids.get());
                                // 发送请求
                                //window.location = "${pageContext.request.contextPath}/dept/removeDept?ids=" + ids.get();
                               $.get("${pageContext.request.contextPath}/dept/removeDept.do?ids="+ids.get(),
                                   function (data) {
                                           if (data == "OK"){
                                               alert("部门删除成功!");
                                               window.location.href = "${pageContext.request.contextPath}/dept/findDept.do";
                                        } else if (data == "FAIL") {
                                            alert("部门删除失败!");
                                            window.location.reload();
                                        } else if(data == "ERROR"){
                                            alert("该部门存在员工,不能删除!");
                                            window.location.reload();
                                        }else {
                                            alert("内部服务器异常!");
                                            window.location.reload();
                                        }
                               });
    
    
                            }
                        });
                    }
                })
  • 相关阅读:
    UML
    Jenkins(Jenkins的安装配置)
    SpringCloud:Config配置中心
    IDEA将项目上传到GitHub
    JS—高阶函数
    项目中git操作
    互联网概述
    ESLint的extends
    vue3 + TS + eslint 实现代码格式化以及代码规范提示
    vue3基础使用
  • 原文地址:https://www.cnblogs.com/mm163/p/11056023.html
Copyright © 2011-2022 走看看