我试图解析数据,以便将其从字符串转换为对象,但是由于某些原因,当我刷新页面时,数据绑定值不断消失。还有一点需要注意,该值存储在我的Web SQL中,因此它从那里调用数据,但是当我刷新页面时,它仍然消失。任何人都可以提供任何想法帮助阻止它消失
HTML:
<p>
<strong>Count: </strong>
</p>
<span data-bind="text: footerDetailViewModel.ApCounts"></span>
JavaScript:
self.saveEngineerSignature = function(footer) {
footer.EngSignature(GetSignature('#EngSignature'));
if ($('#footerEngineerDetailPage').valid()) {
// JSON.parse(footerDetailViewModel.A_Counts());
SaveEngineerSignature(footer, function() {
GetFooter(footer.FormId(), function(row) {
ko.mapping.fromJS(row, {}, CompletionPageViewModel);
CompletionPageViewModel.FormId.valueHasMutated();
GetApplianceCount(footer.FormId(), function(apCount) {
GetDefectCount(footer.FormId(), function(defectCount) {
GetAlarmCount(footer.FormId(), function(alarmCount) {
self.ApCounts(apCount);
self.D_Count(defectCount);
self.A_Counts(alarmCount);
GetAppliances(footer.FormId(), applianceListViewModel.Appliances);
GetAllDefects(footer.FormId(), defectListViewModel.Defects);
GetAlarms(footer.FormId(), alarmListViewModel.Alarms);
PageNavigation('#footerEngineerDetailPage', '#CompletionPage');
});
});
});
});
});
}
};
我期望每次刷新页面时输出上的值都将保持不变并且不会消失,因此数据存储在WebSQL中。因此我对此感到困惑。