参数
var rdsObj = document.getElementsByClassName("rds");
var rds2Obj = document.getElementsByClassName("rds2");
var chacks1Val = new Array();var chacks2Val = new Array();
var k = 0;var k2 = 0;
for(i = 0; i < rdsObj.length; i++) {
if (rdsObj[i].checked) {
chacks1Val[k++] = rdsObj[i].value;
}
}
obj["itemrds"]=chacks1Val;
console.debug(JSON.stringify(obj));
var fields1obj = [];
for(i = 0; i < chacks1Val.length; i++) {
var fields1 = {};
var infotype = getgzxcyfcs(chacks1Val[i]);
var infoname = '';
if('1'==chacks1Val[i]){ infoname = 'xxx';}
else if('4'==chacks1Val[i]){ infoname = 'yyy';}
var infocnt = 'Yes';
fields1["infotype"] = infotype;
fields1["infoname"] = infoname;
fields1["infocnt"] = infocnt;
fields1["onsiteptw"] = obj["onsiteptw"];
fields1obj.push(fields1);
}
var fields1 = fields1obj;
var listpojo = {};
listpojo["mapfilter"] = {};
listpojo["setfield"] = "";
listpojo["listpojo"] = fields1;
var listpojo1 = JSON.stringify(listpojo);
put请求
var url1 = 'http://' + servipport + '/v1/.../update';
$.ajax({
url: url1,
data:listpojo1,
type: "put",
dataType: "json",
headers: {
Authorization: authtoken
},
contentType:"application/json",
success: function (result) {
console.debug('success:'+JSON.stringify(result));
},
error:function(e){
console.debug('error:'+JSON.stringify(e));
}
});