[jQuery] How to access a JavaScript object from within an ajax call?
I am trying to access my own JS object from within an ajax call, and
can't figure out how to get it to work. Whenever I access "this" in
the function, it returns the ajax context and not my JS object
context. My code looks something like this. I have a Zone object
defined in a JS file like this:
//====================START CODE================
function Zone(data){
this.someInfo = data;
this.load = Zone_Load;
}
function Zone_Load(){
$.ajax({
type: "GET",
url: "http://localhost/foo.xml",
success: requestSuccess
});
}
function requestSuccess(data){
this.someInfo = $(data).find('type');
}
//====================ENDCODE================
I am having problems with the last line. How do i get access to the
JS object, so that i can set some info on it, based on the ajax call?
Any help would be appreciated?
thx,
Joe C