Page is a not externally linkable
Fotiman - 5:06 pm on Dec 3, 2012 (gmt 0)
Is the callback value supposed to be a string, or a function reference? It's not exactly clear from the code you provided. Here's an example that you can play around with:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<script>
// externally defined function
function pageFx(selector, settings) {
alert(typeof(settings.callback) + ": " + settings.callback);
if (typeof(settings.callback) === "string") {
eval(settings.callback + "()");
}
else {
settings.callback();
}
}
var do_func2 = "do_func2_";
var URL = "example_com";
function do_func2_example_com() {
alert('in callback');
}
function do_func() {
pageFx(
"#ID",
{
setting: 'value',
//callback: do_func2 + URL
callback: do_func2_example_com
}
);
}
do_func();
</script>
</body>
</html>