I have a JSON file containing:
[{
"title": "title you desire",
"url" : "thisistheurl.com"
},{
"title": "title you desire",
"url" : "thisistheurl.com"
},{
"title": "title you desire",
"url" : "thisistheurl.com"
}]
I am now trying to add these into a JS array, and try to show them as an alert on my mobile:
$.getJSON('links.json', function (json) {
var linkList = [];
$.each(json, function(i, obj) {
linkList.push([obj.title, obj.url]);
});
});
$.each( linkList, function( key, value ) {
alert( value.title + ": " + value.url );
});
But when I run it on my phone no alerts are shown. Any ideas what I might be doing wrong?