1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Jquery中将数组转换成Json

Jquery中将数组转换成Json

时间:2019-08-19 05:57:42

相关推荐

Jquery中将数组转换成Json

场景

在Jquery中遍历多选框,获取属性为checked即被选中的input的value。

实现

function printDetails(){debuggervar checkID = [];//定义一个空数组$("input[name='checkedid']:checked").each(function(i){//把所有被选中的复选框的值存入数组checkID[i] =$(this).val();console.log(checkID);});$.ajax({type: 'POST',url: "/wmsReceiveOrder/doPrintDetailsPostRequest",cache: false, //禁用缓存data:JSON.stringify({"id":checkID}),contentType: "application/json",dataType: "json",async:true,success: function (result) {debuggeralert(result.message)}})}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。