Answers for "jquery ajax send data to wordpressajax_url not defined"

0

jquery ajax send data to wordpressajax_url not defined

function my_enqueue() {

    wp_enqueue_script( 'ajax-script', get_template_directory_uri() . '/js/my-ajax-script.js', array('jquery') );

    wp_localize_script( 'ajax-script', 'my_ajax_object',
            array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
}
add_action( 'wp_enqueue_scripts', 'my_enqueue' );
Posted by: Guest on July-13-2021

Code answers related to "jquery ajax send data to wordpressajax_url not defined"

Code answers related to "Javascript"

Browse Popular Code Answers by Language