Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

wordpress ajax url

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' );
Comment

PREVIOUS NEXT
Code Example
Javascript :: string methods javascript count number of words inside a string 
Javascript :: javascript get hour from date 
Javascript :: sort from the key value js 
Javascript :: remove appended element jquery 
Javascript :: code Execution time in nodejs 
Javascript :: session check in javascript 
Javascript :: chart js x axis start at 0 
Javascript :: xhr request 
Javascript :: jquery search for string in text 
Javascript :: js send get method 
Javascript :: clear input field react-hook-form 
Javascript :: object values javascript 
Javascript :: test undefined js 
Javascript :: search no of item in array 
Javascript :: discord.js rich embed 
Javascript :: define array with custom index javascript 
Javascript :: There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally. 
Javascript :: jquery visible 
Javascript :: javascript tofixed 
Javascript :: object iterate in javascript 
Javascript :: slicknav cdn 
Javascript :: flask socketio example 
Javascript :: push input value to array javascript 
Javascript :: js filter array of objects by value 
Javascript :: react native android safeareaview 
Javascript :: run build version react 
Javascript :: js find space in string 
Javascript :: get hours and minutes and seconds from date in javascript 
Javascript :: require is not defined on html script with electron 
Javascript :: copy to clipboard js 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =