ajax提交数组


   
  function _ok(){
  
var chk_module_value =new Array();
$('input[name="module"]:checked').each(function(){
chk_module_value.push($(this).val());
});
alert(chk_module_value.length==0 ?'你还没有选择任何内容!':chk_module_value);
var module_value = "[" + chk_module_value.toLocaleString() + "]";

var chk_operate_value =new Array();
$('input[name="module"]:checked').each(function(){
chk_operate_value.push($(this).val());
});
alert(chk_operate_value.length==0 ?'你还没有选择任何内容!':chk_operate_value);
var operate_value = "[" + chk_operate_value.toLocaleString() + "]";
$.post("${pageContext.request.contextPath}/roleAuthoriedManager!testAuthorized",{'listModuleId':module_value,'listOperateId':operate_value});
}

jquery Ajax

wfwfwf 12 years, 2 months ago

你既然是用JQuery,那为什么要传数组,直接$('form').serialize()就是整个form的所有内容了,传过去就自然会包含form里的checkbox了

moulu answered 12 years, 2 months ago

Your Answer