Given an instantiated JavaScript object/class can I make an Ajax call from that class and have the returning success function callback into the caller's object?
Currently I can get the callback to return back into the object, but I lose the "this" property, which kills the state of my object
function BaseConsoleHelper()
{
this._iconIndex = 0;
}
BaseConsoleHelper.prototype = {
Dispose: function()
{
this._previousIndex = 0;
},
GetVisitConsoleIcons: function(name)
{
this._iconIndex = 500;
SampleNamespace.MyService.GetConsoleIcons(name, this.IconsGenerated);
},
IconsGenerated : function(result)
{
//I should be 500.....but I'm not, cause "this" has become something else
alert( this._iconIndex );
}
};
BTW I using asp.net ajax 3.5 (and, wow, isn't inheritance different in here than pure JavaScript)