如何使用ajax传递字符串数组
来源:互联网 发布:职场色诱 知乎 编辑:程序博客网 时间:2024/06/05 08:56
通过是使用ajax向后台发送字符串数组,后台接收不到该值?
$.ajax({
type: "POST",
url: url,
data: {contentIds:contentIds,channelId:channelId},
dataType: "json",
success: function(data){
if(data.msg){
alertx(succ,function(){
var f = getTableForm();
f.action="####";
f.submit();
});
}
},
error:function(){
alertx("没有权限执行此操作!");
}
});
后台代码:
@RequestMapping(value = "articleMove")
public @ResponseBody String articleMove(String[] contentIds,String channelId) {}
通过浏览器观察,以及后台拦截参数看到
- contentIds[]:6c7dc887815041f5a787435eb6e3d7e5
- channelId[]:bb2cf2a2e9c54524a8971eeb987541b6
发现参数中会有[]无法对其绑定,在ajax的属性中添加traditional: true,//这里设置为true
后台就可以访问,成功接收数据。
$.ajax({
type: "POST",
url: url,
data: {contentIds:contentIds,channelId:channelId},
traditional: true,//这里设置为true
dataType: "json",
success: function(data){
if(data.msg){
alertx(succ,function(){
var f = getTableForm();
f.action="####";
f.submit();
});
}
},
error:function(){
alertx("没有权限执行此操作!");
}
});
- contentIds:6c7dc887815041f5a787435eb6e3d7e5
- channelId:bb2cf2a2e9c54524a8971eeb987541b6
- 如何使用ajax传递字符串数组
- jquery使用ajax传递数组给struts2
- 使用ajax传递数组和后台接收
- js 使用ajax 传递对象或数组
- jni中如何传递字符串或者数组
- AJAX参数传递时候如何使用JSON
- Jquery ajax传递数组
- ajax传递对象数组!
- ajax传递数组
- Ajax 传递数组问题
- jquery ajax传递数组
- [javascript] javascript 如何在 ajax 直接传递数组
- springMVC中使用ajax向后台传递数组
- jquery中使用ajax传递数组到webservice
- 如何将一个C#字符串数组传递给MATLAB
- 传递自动化字符串数组
- intent传递字符串数组
- intent传递字符串数组
- C++调用Object-C
- 解决Your project contains C++ files but it is not using a supported native build system
- 国家常用代号 for Mysql数据库
- 欢迎使用CSDN-markdown编辑器
- 二分查找的递归和非递归实现
- 如何使用ajax传递字符串数组
- JavaEE软件开发体系架构
- android studio 多渠道打包
- windows install mariadb(zip)
- phpStudy刚启动之后Apache就掉线停了
- MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决方法
- tProfiler
- 关于Collections类的一些操作
- Python偶遇Mysql乱码解决方案