how to work with json feed stored in localStorage in phonegap app?

前端 未结 2 2011
独厮守ぢ
独厮守ぢ 2021-02-06 12:46

Here\'s what I am doing,

Get request to my web server, response is in json. Using jquery templates to render that callback data in my app. Pretty straightforward, works

2条回答
  •  情歌与酒
    2021-02-06 13:21

    You need to use JSON like so:

    localStorage.setItem('foo', JSON.stringify(data));
    

    And then parse it:

    JSON.parse(localStorage.getItem('foo'))
    

提交回复
热议问题