How to register Script for ajax
-
Hi,
Your plugin is great, because it is simple. Thanks for that!
Now, I’d like to enhance some functionality by using scripts for AJAX JQERY handling. How can I register this scripts for my hooks?
I tried this, but had no susscess:
add_action( 'init', 'my_script_enqueuer' ); function my_script_enqueuer() { wp_register_script( "my_custom_script", WP_PLUGIN_URL.'/custom-css-js/my_custom_script.js', array('jquery') ); wp_localize_script( 'my_custom_script', 'myAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ))); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'my_custom_script' ); }
Can you give me some hints?
Kind regards. Don
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to register Script for ajax’ is closed to new replies.