Say I have the following defined in javascript:
com.company.long.namespace = {
actions: {
add: {
defaults: {
url: 'myurl/submit',
},
invoke: function () {
var submitUrl = this.defaults.url;
com.company.long.namespace.foo.util.server.submit({
url: submitUrl,
success: function() { }
});
},
}
}
};
which I then call with within the context of a JQuery click event:
$(myElem).click(function() {
com.company.long.namespace.actions.add.invoke();
});
Because of the way 'this' works within jQuery event callbacks, this.defaults is undefined when called from this context. Is there anyway to still make use of 'this' within this scope, without having to define the full namespace, or without using jQuery.proxy?