I have this function
function getTags(level){ $.getJSON("php/get-tags.php", { "parent": level }, function(json) { return json; }); }
I call this function as
$(function(){ var tags = getTags('0'); });
The problem is that in the getTags() function, return json is similar to
{"tags":["Mathematics","Science","Arts","Engineering","Law","Design"]}
but with var tags = getTags('0') , catching the return value, it gets an undefined value.
Do I believe the wrong value?
source share