This is my json code…
{
"login":{
// ..
},
"setup":{
//...
},
"default":{
// ...
},
"custom":{
"logo":"images\/uploaded\/cne.jpg",
"tabs":[
"home",
"green facts",
"natural gas"
]
}
}
Now here is my jQuery…
function refreshTabs() {
$.getJSON('admin/settings/config.json', function(data) {
$('nav ul').empty();
$.each(data.custom.tabs, function(i, tab) {
$('nav ul').append(
'<li><a href="'+tab.replace(" ", "-")+'.php">'+tab.toUpperCase()+'</a></li>'
);
});
});
}
I must be iterating through this wrong because what gets returned is the tabs in the “default” object… This was working fine yesterday but today it doesn’t seem to be working, not sure exactly what I changed but the code should work shouldn’t it? I need to return the tabs in the “custom” object. What’s the dealio?
As someone earlier posted, then for some reason removed their answer. It worked, so I’m posting it up now.