通过遍历获得列表中被勾选的元素
$("#singcms-push").click(function(){
var id = $("#select-push").val();
if(id==0) {
return dialog.error("请选择推荐位");
}
push = {};
postData = {};
$("input[name=‘pushcheck‘]:checked").each(function(i){
push[i] = $(this).val();
});
postData[‘push‘] = push;
postData[‘position_id‘] = id;
//console.log(postData);return;
var url = SCOPE.push_url;
$.post(url, postData, function(result){
if(result.status == 1) {
// TODO
return dialog.success(result.message,result[‘data‘][‘jump_url‘]);
}
if(result.status == 0) {
// TODO
return dialog.error(result.message);
}
},"json");
});
原文:http://www.cnblogs.com/zzcit/p/5745039.html