我已经按照有关如何本地存储json供线以供离线使用的教程(请参阅下面的链接)。
http://samcroft.co.uk/2013/using-localstorage-to-store-json/
我实现了代码,但不幸的是它没有用。存储json提要但是检索它似乎有问题。我没有任何错误,只是没有显示Feed。
$.ajax({
url: 'path/to/json',
dataType: 'jsonp',
jsonp: 'jsoncallback',
cache: true,
timeout: 5000,
success: function(data, status){
var localData = JSON.parse(window.localStorage.getItem('events'));
$.each(function(key, value){
//do the do
});
var localData = JSON.stringify(data);
window.localStorage.setItem('events', localData);
},
error: function(){
app.showAlert('Something has gone wrong. Please report this issue or check back later.', 'Error');
},
complete: function(){
$('.scroll').removeClass('loading');
}
});
有没有人有任何想法可能会发生这种情况?
由于