我想将数据存储到多维数组或对象中并将数据发送到控制器。我已经在 javascript 中定义了对象,例如
var dynamicprofile = new Object();
var certidarry = [];
var trueorfalse = [];
dynamicprofile.profilename = "certifications";
$(".certclass").each(function (index, element) {
certidarry.push(i);
if (element.checked == false) {
trueorfalse.push(false);
}
else if (element.checked == true) {
trueorfalse.push(true);
}
});
dynamicprofile.idarray = certidarry;
dynamicprofile.trueorfalse = trueorfalse;
dynamicprofile.profilename = "projects";
var projectidarry12 = [];
var trueorfalsearry12 = [];
$(".Projectsclass").each(function (index, element) {
projectidarry12.push(index);
if (element.checked == false) {
trueorfalsearry12.push(false);
}
else if (element.checked == true) {
trueorfalsearry12.push(true);
}
});
dynamicprofile.idarray = projectidarry12;
dynamicprofile.trueorfalse = trueorfalsearry12;
如果看到json
内容,那么它只显示最新信息。但它没有显示之前保存的内容。我怎样才能保存内容。