My AJAX post always returns 0 and I have no idea why PHP
add_action('wp_enqueue_scripts','enable_signup_scripts');
function enable_signup_scripts () {
wp_enqueue_script('signup',get_template_directory_uri().'/signup/script.js' , array('jquery'));
wp_localize_script('signup', 'daten', array('ajaxurl' => admin_url("admin-ajax.php", null)));
};
add_action('wp_ajax_createuser','createuser');
add_action('wp_ajax_nopriv_createuser','createuser');
function createuser () {echo 'hello';};
Script.js
$.post(
daten.ajaxurl,
{
"action": "createuser",
},
function(data){
alert(data)
}
)
Does anyone know the issue?