so basically i have an app.js file which has a function which will pass a parameter
and i have more js files like posts.js, comment.js then i can do app.init('posts');
then i find the file, get it using getscript, but now i need to call the file.
here is my code
init:function(file){
getfile = file;
if($.inArray(getfile+'.js', modular_array)!==-1){
$.getScript("js/modulars/"+getfile+'.js', function(data){
console.log(eval(getfile)["init"]); // this does not! why
//console.log(posts.init()); // this works
});
} else {
console.log('not it');
}
}