Read JSON Data from LocalStorage

by Prasad

HTML

<div data-role="page" id="readdata">
<button id="btnGet">Get Data</button>
<ul data-role="listview" class="parentUL">
  <ul class="slides" data-role="listview">  	
  </ul>
 </ul>
 </div>

JavaScript

$(document).ready(function(){	
$('#btnGet').on('click',function(){
		loadStored();
				
	});
})
function loadStored()
{	console.log("stored called");
	var RJSData=JSON.parse(localStorage.getItem('JSDataS'));
		$.each(RJSData,function(j, tempObj){
					console.log(j+':'+tempObj);
					if(tempObj == '' || tempObj==null)																	
							{	
								console.log("\n"+"Skipped "+j+"th Element"+"\n");
							}
							else
							{
								$(".slides").append("<li id='"+tempObj+"' data-icon='false'><a href='#'>"+tempObj+"</a></li>").listview('refresh');								
							}
			})
}