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();

I realise that 'this' will not actually point to the instance of
myObject when the callback is run but how CAN I access it ?


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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to