After page migration I have a problem with all AJAX calls. They always returning 0. I probably done everything and can't figure out what is wrong? Could you help me please?
Ajax call as shorten form:
$.ajax({
url : '/wp-admin/admin-ajax.php',
type : 'post',
dataType: 'JSON',
data : {
action : 'ajax_newsletter',
email : '[email protected]'
},
success : function( response ) {
console.log(response);
},
error: function(err){
console.log(err);
}
});
Functions.php function as shorten form:
function ajax_newsletter() {
$response = [];
$resposne['succcess'] = true;
wp_send_json($response);
wp_die();
}
add_action('wp_ajax_ajax_newsletter', 'ajax_newsletter');
add_action('wp_ajax_nopriv_ajax_newsletter', 'ajax_newsletter');