Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- inserting a variable into a function


sssweb - 4:26 pm on Dec 3, 2012 (gmt 0)


I want to insert a variable into the settings I pass in a function. My code is:

function do_func() { pageFx("#ID", {setting: 'value', callback: do_func2_ + URL }); }

where 'pageFx' is the script call for a third-party animation script, and the {...} are my settings for that script. The problem is the callback -- I want to add part of the page URL to the function name so as not to conflict w/like-named functions on other pages. I set var URL earlier and want to add it here. But the javascript only reads 'do_func2_' as the name, omitting var URL. I tried adding quotes around "do_func2_" but that doesn't work either.

What's missing?


Thread source:: http://www.webmasterworld.com/javascript/4524548.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com