Ajax请求传递数组参数
var ids = [];
        var rows=$("#tt").datagrid("getSelections");
        for(var i=0; i<rows.length; i++){
            ids.push(rows[i].phonenumber);
            }
       $.ajax({
            async : false,
            cache : false,
            traditional: true,//防止深度序列化
            type : 'POST',
            data : {
                ids:ids
            },
            url : "personalInfoController.do?SendMSG",// 请求的action路径
            error : function() {// 请求失败处理函数
            },
            success : function(data) {
                var d = $.parseJSON(data);
                if (d.success) {
                    var msg = d.msg;
                    tip(msg);
                }
            }
        });

@RequestMapping(value = "/add", method = RequestMethod.POST)
    public @ResponseBody Message add(HttpServletRequest request, String messageTitle, String messageContent, Long ids[]){

        return Message.success("新增消息成功");
    }

 

posted on 2018-06-27 20:33  james-roger  阅读(2025)  评论(0编辑  收藏  举报