When using: –
$.getJSON("admin.php?format=json", { module: "data", action: "allBusinessUnitsByClientName", clientname : $('#client').val() }, function(json) {
$.each(json.items, function(i,item){
alert(i);
});
});
I get the following error in the Firebug console:-
a is undefined
a))();else c.error("Invalid JSON: "+a)...f(d)if(i)for(f in a){if(b.apply(a[f],
The Json being returned is in the following format: –
{"550":"Test 1","547":"Test 2","549":"Test 3"}
You’re getting this because
json.itemsisundefinedhere, you just wantjson(your object being returned, which has noitemsproperty), like this: