jquery ajax post 傳遞數組 ,多checkbox 取值

使用$.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;
			});

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章