uhbc

Set variable for JSON.

Posted 1 year ago by uhbc
var variable = 'somevalue';

$.get(url, function(e){
console.log( e[0].variable );
});

How can i do something like this, i've tried almost everything but couldn't make it work.

-- The reason i wanna do that is that in the json output there are values like; a1, a2, a3 and i wanna get the value of a1 when its 10pm and get a2 when its 5am ect.

I get an error like : " Cannot read property 'variable' of undefined "

Thanks.

Please sign in or create an account to participate in this conversation.