Home > Not Working > Wp_localize_script Ajax Not Working

Wp_localize_script Ajax Not Working


In this case, I have only passed one array key, so we will have just one option, but you can have as many as you want. Note that this should be unique to both the script and to the plugin or theme. But when I inspect the DOM in chrome it isn't there. Here is my code. have a peek here

functions.php function my_scripts_method() { wp_enqueue_script( 'ajax_script', get_stylesheet_directory_uri() . '/js/ajax_script.js', array( 'jquery' ) ); } add_action( 'wp_enqueue_scripts', 'my_scripts_method' ); wp_localize_script('ajax_script', 'WPURLS', array( 'siteurl' => get_option('siteurl') )); ajax_script.js $(function () { $('#vru-btn').click(function() { See this post: https://pippinsplugins.com/why-loading-your-own-jquery-is-irresponsible/ Mabi August 25, 2015 Well yes, that irresponsible is me then. Sign up here to receive an email from us when a new post goes live.Submit Skip to content Ignore Learn more Please note that GitHub no longer supports old versions WordPress Development Stack Exchange works best with JavaScript enabled current community chat WordPress Development WordPress Development Meta your communities Sign up or log in to customize your list.

Wp_localize_script Ajax Not Working

more hot questions question feed default about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation Reload to refresh your session. asked 3 years ago viewed 1369 times active 3 years ago Blog How We Make Money at Stack Overflow: 2016 Edition Stack Overflow Podcast #94 - We Don't Care If Bret

If you then look at your source code you'll see: