I have a problem understanding this problem. I have this json in a file called list.json for testing purpose. I will be getting this list generated by server later on.
[
{
name : "ABC",
id : "link_abc"
},
{
name : "DEF",
id : "link_def"
},
{
name : "GHI",
id : "link_ghi"
},
{
name : "JKL",
id : "link_jkl"
}
]
And here's my javascript to display the list in <li> format.
$(function(generate_list_from_JSON){
$('a[href="#state"]').click(function(){
$.getJSON("scripts/list.json", function (obj){
$.each(obj.name, function (key, value){
alert(key);
})
});
});
});
The problem is, there's nothing displayed, even in console. How do I trap what's sending and what's receiving? I tried console.log() but still blank.