I am not sure if this is possible. I would like to pass in a function name as parameter like this
loadContent("http://test.com/", specialFunction);
specialFucntion
is just a string :
function loadContent(href, functionIWant){
$.ajax({
type: "GET",
url: href,
dataType: "json",
success: function(res, textStatus, xhr) {
helper();
functionIWant + "()"; //So this would be treated as function
//and it actually calls specialFunction()
//is it possible for this?
}
});
}
How do I achieve this?
ADD-ON
Let's say, I would pass in an array of function names, how do I call it?
for(var i = 0; i < functionIWant.length; i++){
functionIWant[i]; // how? appeciate a lot :)
}