I am trying to work with ubonstrustive dom ready that looks something like this,
var app = {
common : {
init: function() {
//Initialisate the request object
app.request.init();
}
},
request: {
users : "helloworld",
init: function() {
alert("...request started...");
$('form').on('change', '#workbase', this.workBaseChange);
},
workBaseChange: function(e) {
var that = this;
console.log(this);
}
},
validation : {}
}
UTIL = {
fire : function(func, funcname, args) {
var namespace = app;
funcname = (funcname === undefined) ? 'init' : funcname;
if(func !== '' && namespace[func] && typeof namespace[func][funcname] == 'function') {
namespace[func][funcname](args);
}
},
loadEvents: function() {
UTIL.fire('common');
$.each(document.body.className.split(/\s+/), function(i, classnm){
UTIL.fire(classnm);
});
}
};
$(document).ready(UTIL.loadEvents);
request.workBaseChange fires when a select menu is changed, but if log this
in that function it return the changed select
not the request object as I would expect, am I doing something incorrectly? How do I get the context of request{}?