Monday, January 4, 2010

[jQuery] Callback in $.getJSON is called but variable assignment doesn't persist.

Hi,
on the following code:

$.getJSON("http://www.tametick.com/test2/json/settings.json",function
(data) {
this.Settings = data;
alert(data);
alert(this.Settings);
});

which can be found on http://www.tametick.com/test2 (line 63 in
http://www.tametick.com/test2/js/cardinal-quest.js), I am getting the
alerts correctly (returning the object read from the file) but after
the function ends this.Settings revurts back to null and I get the
error:

Error: Settings is undefined
Source File: http://www.tametick.com/test2/js/cardinal-quest.js
Line: 70

Any idea what is going wrong?

Thanks,
Ido.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate