I am using getJSON to get results from a different domain and i wanted
to get _some_ object back when calling getJSON so that i can insert
some variables into the callback scope.
Basically, what i wanted to do was this:

var new_json = $.getJSON(url, function(data) {
                                                 alert
(this.variable_from_caller);
                                                });
new_json.variable_from_caller = 'value';

The problem is that since url is on a different domain, the call to
getJSON (which end up calling ajax) returns undefined and not an
object that can be referenced (this is on line 3504 of the
uncompressed jquery-1.3.2.js).

I've noticed that if i change undefined to s i can reference the
object from outside and have the variable exist within 'this' inside
the anonymous callback, although s is not an XMLHttpRequest.

Is this a bug? am i doing something wrong or twisted and there's a
much easier way of accomplishing this in a way i am not aware of?

Reply via email to