if (json_goals === undefined)
{
ajax.get('/assets/ajax/user_goals.php', function (resp)
{
var json_goals = resp;
return json_goals;
});
}
alert(json_goals);Make Variable Global
-
unemployment
- Posts: 165
- Joined: Fri May 06, 2011 5:02 pm
Make Variable Global
How can I make my alert work? Right now it is undefined and I need to make my function in the variable global. Can this be done?
-
unemployment
- Posts: 165
- Joined: Fri May 06, 2011 5:02 pm
Re: Make Variable Global
Fixed... no worries
Re: Make Variable Global
And for people who fund this page via google the solution is to declare the variable outside of a function.
var this_is_global = true;
function Im_a_function(){
// here you can use the variable this_is_global.
}