jquery ajax post 传递数组 ,多checkbox 取值
2015-10-26 00:46
716 查看
使用$.each(function(){});可以得到checkbox 中对应的值,
在ajax上传的时候需要把 traditional 设置为 true
$('.but_delet_choice').click(function(){
var $check_boxes = $('input[type=checkbox][checked=checked][id!=check_all_box]');
if($check_boxes.length<=0){ alert('您未勾选,请勾选!');return; }
if(confirm('您确定要删除吗?')){
var dropIds = new Array();
$check_boxes.each(function(){
dropIds.push($(this).val());
});
$.ajax({
type:'post',
traditional :true,
url:'${ctx}/discuss/dropMoreRmb',
data:{'dropIds':dropIds},
success:function(data){
refreshRmb(1);
}
});
}
return false;
});
来源 http://w8700569.iteye.com/blog/1954396
在ajax上传的时候需要把 traditional 设置为 true
$('.but_delet_choice').click(function(){
var $check_boxes = $('input[type=checkbox][checked=checked][id!=check_all_box]');
if($check_boxes.length<=0){ alert('您未勾选,请勾选!');return; }
if(confirm('您确定要删除吗?')){
var dropIds = new Array();
$check_boxes.each(function(){
dropIds.push($(this).val());
});
$.ajax({
type:'post',
traditional :true,
url:'${ctx}/discuss/dropMoreRmb',
data:{'dropIds':dropIds},
success:function(data){
refreshRmb(1);
}
});
}
return false;
});
来源 http://w8700569.iteye.com/blog/1954396
相关文章推荐
- jquery获取url参数及url加参数的方法
- jQuery.trim() 函数及trim()用法详解
- 基于jQuery实现搜索关键字自动匹配功能
- jquery移动端TAB触屏切换实现效果
- 基于jquery实现鼠标滚轮驱动的图片切换效果
- .net MVC 用jquery读取表单数据,AJAX异步提交表单例子
- jquery UI 隐藏关闭按钮
- jQuery插件 -- Cookie插件jquery.cookie.js(转)
- JQueryUI(Accordion)
- jquery 筛选元素(1)
- JQuery ligerUI ligerTree 基本使用方法
- jQuery学习之旅 Item2 选择器【二】
- jQuery学习之旅 Item2 选择器【二】
- JQUERY获取当前页面的URL信息
- jQuery Raion, Select, CheckBox selector function
- JavaScript之三:jQuery插件开发(一)
- 三、jQuery--jQuery基础--jQuery基础课程--第2章 jQuery 基础选择器
- jQuery事件绑定.on()简要概述及应用
- jQuery事件绑定.on()简要概述及应用
- jquery获取input的value问题说明