js(jQuery)获取多选框选中的值并以数组形式提交给后台

var understandChannels_valueList = [];
$("input[name='understandChannels']:checked").each(function () {
	understandChannels_valueList.push($(this).val());
})
var channelsOthers = $("#channelsOthers").val();
var APPChannels_valueList = [];
$("input[name='APPChannels']:checked").each(function () {
	APPChannels_valueList.push($(this).val());
})
var APPChannelsOthers = $("#APPChannelsOthers").val();
var haoContact_valueList = [];
$("input[name='haoContact']:checked").each(function () {
	haoContact_valueList.push($(this).val());
})
var crmParam = {
	"id":id,
    "understandChannels":understandChannels_valueList,
    "channelsOthers":channelsOthers,
    "APPChannels":APPChannels_valueList,
    "APPChannelsOthers":APPChannelsOthers,
    "haoContact":haoContact_valueList
};
$.ajax({
	url:"https://crmtest.amcare.com.cn/crm-api/modifyCustomer",
    type:"POST",
    headers:{"channel":"self"},
    crossDomain: true,
    contentType:"application/json",
    data:JSON.stringify(crmParam),
    dataType:"json",
    success:function (data) {
    	if (data.code==0) {
    		window.location.href ='success.html';
        }
    },
    error:function (data) {
        editFail();
        console.log("出错了");
    }
})
展开阅读全文
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值