So I have these two javascript functions:
function some_name(say_something){
console.log('hello' + say_something);
}
call_other_fuction_after_doing_something('some_function')
// In some other file, some where - in the land of make believe.
function call_other_fuction_after_doing_something(function_name){
$.ajax({
url : /*Go some where*/,
type : 'POST'
data : { /*Some kind of data*/},
success : function(result){
if(function_name !== undefined){
$.fn[success_action](result); // Pay attention to this!
}
},
});
}
So as we can see I do some function in some file, some where that logs to the console: "hello" which then has what ever the result is that comes back from the ajax call appended to it.
I assumed this would work, as I read something about this here in this question. But apparently I was wrong as the error I get is:
Uncaught TypeError: Object [object Object] has no method 'some_name'
Any ideas how to do this kind of "Reflection" in javascript (jquery)?