jsp数组自动转换html,jsp页面将选中的复选框转数组传到后台

ajax选中的复选框转数组传到后台

var selectedItems = new Array();

$(':input[class=ids][checked]').each(function() {

selectedItems.push($(this).val());

});

$.ajax({

type: "post",

url: "",

data: {items: selectedItems.join(',')},

async:false,

success: function(date){

if(date==1){

alert("选中的数据中存在已经上报的数据");

}

}

});

数据items 以字符串的形式传到后台

jsp中的checkbox怎么将选中的值传到后台

${list.fieldName}

不共享

普通共享

按需共享

在循环列出的所有资源项中,将勾选的checkbox的值拼接成字符串传到后台:

function nextStep(){

var box = document.getElementsByName("apiContent");

var objArray = box.length;

var apiContentStr="";

for(var i=0;i

if(box[i].checked == true){

apiContentStr += box[i].value+",";

}

}

if(apiContentStr == "" || apiContentStr.length == 0){

alert("请勾选需要的资源项!");

return;

}

apiContentStr = apiContentStr.substring(0, apiContentStr.length-1);

$('#MainForm').attr('action', '${ctx}/api/toEditApply?apiContentStr='+apiContentStr);

$('#MainForm').submit();

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值