Results 1 to 2 of 2
  1.    #1  
    Code:
    function TestAssistant(testVar) {
    	this.Test_Var = testVar;
    }
    TestAssistant.prototype.getTimeInfo = function(){
    	this.controller.serviceRequest('palm://com.palm.systemservice/time', {
    		method: "getSystemTime",
    		parameters: {},
    		onSuccess: this.handleTime.bind(this),
    		onFailure: this.handleErrResponse.bind(this)
    	});
    };
    TestAssistant.prototype.handleTime = function(response){
    	var jsonResp = Object.toJSON(response);
    	var obj = eval('(' + jsonResp + ')');
    	$('area-to-update').update("System Time is: <br><br>" + jsonResp);									 
    };
    If I wanted to update this.Test_Var from inside the handleTime function I can't use
    Code:
    this.Test_Var = jsonResp
    because 'this' is now referencing something else, I actually don't know what it is referencing, perhaps the earlier call? How would I update the 'this.Test_Var' from inside handleTime?

    I feel like a novice all the sudden :-)
  2.    #2  
    Figured it out.

    Declaring in the method a
    var self = this;

    then inside the onsuccess call something like
    Code:
    onsuccess: function(event) {
    self.handle..(event);
    }
    Got it to work. Woo stackoverflow!

Posting Permissions