I have the following JSon
{
"expertises": {
"leadership": {
"detail1": "+++++",
"detail2": "++++",
"detail3": "+++"
},
"Project management": {
"detail1": "++++",
"detail2": "+++++"
}
}
}
and the following code.
var data = $.ajax({
url: 'js/expertise.json',
dataType: "json",
success: function(data){
$.each(data.expertises, function(key, value){
if(name == key){
return value;
}
});
},error: function(request, error){
console.log("a wild error has occured! " + error);
}
});
When I run this it reads the json just fine and it loops through it just fine, but when it gets to the last each cycle it pushes the error out. any ideas what I am missing here. I have tried using arrays surrounding the objects but to no avail.