I’ve tested your code and it works perfectly. I’ve just declared the dependencies for the JavaScript, so it is loaded correctly after jQuery. This is how I’ve tested it: functions.php function my_resource() { wp_enqueue_script(‘my-jquery’,get_template_directory_uri().’/jqfunctions.js’, array(‘jquery’)); wp_localize_script( ‘my-jquery’, ‘myback’, array(‘ajax_url’ => admin_url( ‘admin-ajax.php’ ))); } add_action(‘wp_enqueue_scripts’, ‘my_resource’); function getsomething(){ wp_send_json_error(‘hey’); } add_action(‘wp_ajax_nopriv_getsomething’, ‘getsomething’); add_action(‘wp_ajax_getsomething’, ‘getsomething’); jqfunctions.js … Read more