Ajax传递数组参数

ajax请求时,如果参数是数组,后台是获取不到,有时候需要给他通过join方法,转换为字符串传递,
 
 

看到一个这样的写法,有机会了试一下,记录下来加上
traditional: true,//这里设为true就可以了

$.ajax({ 
    url: 'xxxx.do', 
    data: { ids: ids}, 
    dataType: "json", 
    type: "POST", 
    traditional: true,//这里设为true就可以了
    success: function (responseJSON) { 
        alert('Ok'); 
    } 
}); 

猜你喜欢

转载自blog.csdn.net/qq_38880700/article/details/80801838