• Resolved Larry Daniele

    (@larrydaniele)


    Thanks for a handy plugin!

    In show-hooks.php line 248, there’s this line of code:

    wp_localize_script('abc-main-js', 'abc-main-js', array(

    The second parameter (‘abc-main-js’) is supposed to be a valid JavaScript variable name, but JavaScript does not allow “-” in variable names, so in the browser console I see:

    JavaScript Uncaught SyntaxError: Unexpected token ‘-‘

    Changing this second parameter to ‘abc_main_js’ fixes the problem.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘wp_localize_script() triggers Uncaught SyntaxError: Unexpected token ‘-‘’ is closed to new replies.