Note that there are some explanatory texts on larger screens.

plurals
  1. POLocalstorage cleared after restarting the application on phonegap IOS?
    text
    copied!<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>
 

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