Hi,

I think my question is about closures, but i'm not 100% sure.
I have a function within an object, and within it I want to override another function of the same object.
Code javascript:
var Ajax = {
...
  updatePanel: function(panel, file) {
    Ajax.request('Text', file);
    Core.emptyElement(panel);
    Ajax.showLoading(panel);
    Ajax.displayResponse = function() {
      Core.emptyElement(panel);
      // Don't copy Ajax.response yet - it hasn't been set.  When it has been, 
      // displayResponse will be called and then copy it across.
      panel.innerHTML = Ajax.response;
      Ajax.fadeIn(panel);
    };
  },
...
}

So displayResponse is another function of Ajax, if updatePanel is called I want the displayResponse function to replace an element with the variable Ajax.response.

The problem is that panel.innerHTML is set to Ajax.response set when updatePanel is called, And not when displayResponse is called.

I hope that makes some sense,


Thanks,