Jquery ajax传递数组
来源:互联网 发布:linux bash profile 编辑:程序博客网 时间:2024/04/29 15:37
前言
使用jquery ajax传递参数的时候,通常都会使用字符串,遇到复杂对象时也是会将数据转换成Json,然后在使用json2等工具转换成字符串,然后再到后台对json字串进行解析。不过在传递数组的时候一直很纠结,当然把数组转换成字符串或json都可以。这里介绍一种ajax传递数组的方法,感觉代码稍简单一些,没有编码 和解码的操作了。
前台
function batchDelete(){var ids = new Array();$('input[name="roleCheck"]:checked').each(function(){ // alert($(this).val())ids.push($(this).val()); });$.ajax({ url : '${ctx}/role/batchDeleteRole.do', cache : false, type : 'post', dataType : 'html', async : false, contentType : "application/x-www-form-urlencoded;charset=utf-8", data : { 'ids' : ids }, success : function(htmlRet) { //alert("xxx1") } }) refreshForm();}
后台
@RequestMapping("/batchDeleteRole")public void batchDeleteRole(HttpServletRequest request,HttpServletResponse response){String[] roleids = request.getParameterValues("ids[]");String ret = "0";/**/for(String roleid:roleids){ roleService.deleteRole(roleid);}// ret = "1";ResponseUtil.writeResponseStr(response, ret);}
0 0
- Jquery ajax传递数组
- jquery ajax传递数组
- jquery ajax传递数组参数
- JQuery.ajax传递数组问题
- jquery ajax前台传递数组
- jquery ajax 传递数组数据
- jquery ajax传递关联数组
- Jquery Ajax 传递数组参数
- Jquery Ajax 传递对象数组
- jQuery $.ajax传递radio数组
- jQuery Ajax 全解析(传递数组问题)
- JQuery Ajax向后台传递数组
- jquery使用ajax传递数组给struts2
- jquery ajax 向后台传递数组
- jquery ajax传递数组参数问题
- JQuery Ajax向后台传递数组
- jQuery.ajax向后台传递数组问题
- jquery ajax 向后台传递数组参数
- Linux Programmer’s Manual -- unnamed semaphore
- 哈佛校训二十条
- bzoj1208(splay tree)
- linux read 用法
- android app 头像上传原理
- Jquery ajax传递数组
- myeclipse 6.5 生成注册码的java代码
- CSU-1408: 种植树苗
- 浮点列类型
- POJ 2828 Buy Tickets (线段树 单点更新 插队问题)
- Gradle脚本对Java项目工程编译,打包,运行和发布具体过程详例
- xamarin.ios 代码中设置启动的 Storyboard
- UML之轻松入门(2)-掌握Junit,让我们的开发更高效
- Java的网络编程解析