So I have a json string that Looks like this
var jsonString = '[{"name":"John Smith","uid":1234,{"name":"Susie Something","uid":4567"}]';
I'm making a function that will return all the UIDs seperated by commas. So for example: 1234,4567.
What I do now is this
function getUIDS(json){
var uids = '';
parsed = JSON.parse(json);
$.each(friends, function() {
uids = uids + this.uid.toString() + ',';
});
reuturn uids;
}
However, nothing returns. How can I access a variable that was created by a jquery thread, outside of the jquery thread.
reuturn? Furthermore, check the JSONstrings. Third, you should parse the JSON before you can use it as an object.friends(which is not defined), notparsed.