function orgNameAndIdListClass(id, name) {
this.label = name;
this.value = name;
this.idValue = id;
}
orgNameAndIdList = [];
$.get("../organizationSourceMapping/listOrg.htm?sourceMasterFilter=",
function(response) {
if (response.status == "LIST_SUCCESS") {
var listOrgIdAndName = response.successObject.listOrgIdAndName;
for (var i = 0; i < listOrgIdAndName.length; i++) {
var orgNameIds = new orgNameAndIdListClass(listOrgIdAndName[i].id, listOrgIdAndName[i].organizationFullName);
orgNameAndIdList.push(orgNameIds);
}
}, 'json')
.fail(function(response) {
$('#page-wrapper').mask(
response.status + "**********" + response.statusText);
}); console.log(JSON.stringify(orgNameAndIdList))
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
我的orgNameAndIdList每个对象都显示像
这样的数据idValue:1
label:"org1"
value:"org1"