Note that there are some explanatory texts on larger screens.

plurals
  1. POLocalstorage cleared after restarting the application on phonegap IOS?
    primarykey
    data
    text
    <p>I am trying to cache JSON data on in localstorage to load it when there is no internet connection. It is working fine but when I restart the app I think the localstorage cleared</p> <p>Here is my code:</p> <pre><code>document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { document.addEventListener("offline", function() { alert("No internet connection"); $.each(JSON.parse(localStorage.getItem('foo')), function(key, val) { if(!(val.php)){val.php=0;} $('ul.get-mertchant').append('&lt;li&gt; &lt;a href="azkadenya.html?id=' + val.nid + '&amp;nop='+ val.php +'" class="li-link"&gt;&lt;div class="circle-img"&gt;&lt;img src="'+ val.logo + '" /&gt;&lt;/div&gt;&lt;div class="merchant-info"&gt;&lt;h1&gt;'+ val.node_title +'&lt;/h1&gt;&lt;p&gt;You Have '+ val.php +' Binggz&lt;/p&gt;&lt;/div&gt;&lt;div class="more-icon"&gt;&lt;/div&gt;&lt;/a&gt; &lt;/li&gt;'); }); }, false); $.getJSON('mywebsite/views/services_merchant_mobile', function(data) { localStorage.setItem('foo', JSON.stringify(data)); var items = []; $.each(JSON.parse(localStorage.getItem('foo')), function(key, val) { if(!(val.php)){val.php=0;} $('ul.get-mertchant').append('&lt;li&gt; &lt;a href="azkadenya.html?id=' + val.nid + '&amp;nop='+ val.php +'" class="li-link"&gt;&lt;div class="circle-img"&gt;&lt;img src="'+ val.logo + '" /&gt;&lt;/div&gt;&lt;div class="merchant-info"&gt;&lt;h1&gt;'+ val.node_title +'&lt;/h1&gt;&lt;p&gt;You Have '+ val.php +' Binggz&lt;/p&gt;&lt;/div&gt;&lt;div class="more-icon"&gt;&lt;/div&gt;&lt;/a&gt; &lt;/li&gt;'); }); }) } </code></pre> <p>what is wrong??</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload