码迷,mamicode.com
首页 > 编程语言 > 详细

ajax传输数组类型的参数

时间:2019-12-11 15:50:30      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:success   ==   参数   post   ppi   组类型   service   customers   string   

$.ajax({
               type:"post",
               traditional: true,
               data:{arr:arr},
               url:"${pageContext.request.contextPath}/customer/deleteById",
               dataType:"json",
               success: function (msg) {
                 if(msg.code==200){
                     window.location.href="${pageContext.request.contextPath}/customer/findAll";
                 }else{
                     alert("删除失败");
                     window.location.href="${pageContext.request.contextPath}/customer/findAll";
                 }


               }


控制层代码:
@RequestMapping("deleteById")
    @ResponseBody
    public Map<String ,Object> deleteById(String [] arr){
        Map<String,Object> map=new HashMap<>();
        boolean b= customerService.deleteById(arr);
        if(b){
            map.put("code",200);
        }else {
            map.put("code",500);
        }
       return map;
    }

ajax传输数组类型的参数

标签:success   ==   参数   post   ppi   组类型   service   customers   string   

原文地址:https://www.cnblogs.com/ych961107/p/12022973.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!