Hi all,

I trying to understand the right way to access the properties of my
object from within a function called by the $.getJSON function. Here
is an example of what I have:

function MyWidgetObject(_parentObject){
    this.parentObject = _parentObject;

    this.jsonFunc = function(){
        $.getJSON("json.js", this.processJSONFunc);

    }

    this.processJSONFunc = function(jsonObj){

    //this doesn't work, tells me its undefined
    alert(this.parentObject);

    //this DOES work
    alert(_parentObject);

    }


}

My question is: what is the best way to access the properties of the
MyWidgetObject, like MyWidgetObject.parentObject ? Please let me know
if I can provide any more information. Thanks for reading!

Reply via email to