myObj = new Object(); myObj.foo = "test"; var foo; $.getJSON("php/json.php", "", function(json){ myObj.foo = json.foo; foo = json.foo; alert(myObj.foo); alert(foo); }); }