我有这个功能:
var getData = function (obj) {
for(var i = 0, j = localStorage.length; i < j; i ++) {
var newKey = localStorage.key(i);
var newValue = localStorage.getItem(newKey);
var newObj = JSON.parse(newValue);
var ulListView = $('#container').append('<ul data-role="listview" data-split-icon="minus" data-split-theme="c" data-inset="true" id="ulOrigin'+i+'"></ul>');
var dynPage = $(newObj[1].value).trigger('create');
//var dynPage = $('<div data-role = "page" id = "'+newObj[1].value+'"><div data-role = "header"></div><div data-role = "content"></div><div data-role = "footer"></div>"</div>');
var insideLi = $('#ulOrigin'+i).append('<li><a href="'+dynPage+'"><img src="images/'+newObj[0].value+'.png"><h2>'+newObj[1].value+'</h2><p>'+newObj[0].value+'</p></a><a href = "#deleteObject" data-rel = "popup" data-position-to = "window" data-transition = "pop">Delete Entry</a></li>');
var pageNum = $('#ulOrigin'+i);
console.log(newObj);
}
};
我正在尝试创建一个动态页面,其名称取自newObj[1].value
. 访问链接时,我得到的错误是Error Loading Page
. 在控制台中我有: 也OPTIONS file:///home/<address>/[object%20Object]
标记为错误。
我正在使用 jQuery Mobile 1.3.0