我有这个功能,我想创建另一个函数来再次检索模型上的复选框数组(USER_CARD_DECLARE_DATA_List)
userobj.SaveDeclarationForm = function ()
{
var USER_CARD_DECLARE_DATA_List = []
$(".option").map(function () {
var USER_CARD_DECLARE_DATA = {}
if ($(this).find(".RESULT_VAL")[0].checked == true) {
USER_CARD_DECLARE_DATA.RESULT_VAL = 1;
}
else {
USER_CARD_DECLARE_DATA.RESULT_VAL = 0;
}
USER_CARD_DECLARE_DATA_List.push(USER_CARD_DECLARE_DATA);
})
$('#myModal').modal('hide');
userobj.declaration = USER_CARD_DECLARE_DATA_List;
}
答案 0 :(得分:0)
更改
var USER_CARD_DECLARE_DATA_List = []
为:
var USER_CARD_DECLARE_DATA_List = this.USER_CARD_DECLARE_DATA_List = []
现在,您可以使用userobj
的其他方法访问数组:
this.USER_CARD_DECLARE_DATA_List