批量删除和ajax提交

2016-12-12 19:59:23来源:CSDN作者:lmy_1人点击

functionDeleteTblUser(){

    if(confirm("确定要删除吗?")==true){

       varuserValue= "";

       $("input[name='check']").each(function(i){

           if($(this).attr("checked")==true){

              userValue+= $(this).val()+"@";

           }

       });

       if(userValue== "" &&userValue == null){

           alert("请至少选择一项删除!");

           returnfalse;

       }else{

           //去除最后一个@

           userValue= userValue.substring(0,userValue.length-1);

           //ajax提交

           $.ajax({

              type:"POST",

              url:'queryAction!deleteUser.action',

              data:"userID="+ userValue,

              beforeSend:function(XMLHttpRequest){

                  $("#del")[0].value='正在删除...';

              },

              success:function(msg){

                  furl='queryAction!query.action';

                  window.location.href= furl;

              }

           });

       }

    }else{

       returnfalse;

    }

 

}

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台