In this line of code:
WinJS.xhr({ url: searchUrl }).done(this._lookUpSuccess, this._lookUpFail, this._lookUpProgress);
You pass _lookupSuccess as a handled function to the handler, but when it is called, the value of this is not what you want, because it will be set by the internals of any calls by the handler, this._lookUpSuccess , because the function simply passes the function. It does not skip this value. So, when this._lookUpSuccess is called with the wrong this , any references to this inside it will not find the expected properties on it (thus, you see an error).
You can fix this so that the this value is stored in a local variable, and then use it when calling _lookUpSuccess() :
var self = this; WinJS.xhr({ url: searchUrl }).done(function(result) {self._lookUpSuccess(result)}, this._lookUpFail, this._lookUpProgress);
It is a very common job to reconnect the correct this value in callbacks.
source share