This is the code that currently I have, it works to the extent that it finds data.success and launches the next page when the correct value is returned, what I am having trouble with is parsing some additional data and passing to local storage so I use it on the next page, e.g user id, user name etc
$.post(postTo,{email:value1 , password:value2, tag:tagvar} ,
function(data) {
//$('#output').html('inside');
if(data.success == '1') {
$.mobile.changePage( "home.html", { transition: "flip"} );
} else {
$('#output').html('Could not connect please try again');
}
},'json');
return false;
});
});
Here is the JSON returned from the request…
{"tag":"login","success":1,"error":0,"uid":"4fc3562b9a8369.38575999","user":{"name":"test","email":"test@test.ie","created_at":"2012-05-28 11:40:43","updated_at":null,"ac":"8","user_type":"1"}}
I really am unsure of how to parse properly and also how to use local storage.
Many Thanks
If you want to see that data parsed, you can use this nifty online parser: http://json.parser.online.fr/
From that point, you should be able to access and save whatever you need to (for example data.user.name).
As for saving data into local storage, check out W3C manual on that subject. Example: