I'm a little confused about context and how to access things correctly
when my ajax request onSuccess function runs.
My code currently looks something like this:
var MyObject = Class.create({
initialize: function() {
this.items = [];
},
loadItemsFromUrl: function(url) {
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport) {
// how can I access 'this.items' from here ???
}
});
}
});
var myObject = new MyObject();
myObject.loadItemsFromUrl('http://www.blah.com/items');
I realise that 'this' will not actually point to the instance of
myObject when the callback is run but how CAN I access it ?
thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---