wp_localize_script
-
I am trying to get my localize script to work however whenever I run the script I get the object is not defined.
I am updating one of my plugins to ajax and using Tom McFarlin’s Plugin Boiler Plate.
Here is my php code:
wp_localize_script('ajax-js', 'ajax_params', array( 'alert' => __('Hey! You have clicked the button!', 'my-plugin') ));
here is my script:
jQuery(document).ready(function($){ $('.someClass').click(function(){ alert(ajax_params.alert); }); });
Yet when I click on the button it get the error that ajax_params is not defined.
What am I missing.
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘wp_localize_script’ is closed to new replies.