admin管理员组文章数量:1130349
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');
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');
本文标签: All WordPress AJAX calls always return 0
版权声明:本文标题:All WordPress AJAX calls always return 0 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749022728a2304627.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论