wp-admin ajax 请求 returns 0
wp-admin ajax request returns 0
wp-admin ajax 无论我怎样尝试,请求总是给出 0 作为响应。我阅读了许多在 Google (including this in SOF) 中找到的解决方案、文章和答案,我相信我的代码是正确的。
我的ajax调用如下:
$.ajax( {
url : base_url
+ "/wp-admin/admin-ajax.php",
type : 'POST',
cache : false,
dataType : "json",
data: {action: "get_next_post_with_ajax"},
success: function(response){
// functions I'll work on success..
}
});
...我的 ajax 处理程序操作是这样的:
add_action("wp_ajax_nopriv_get_next_post_with_ajax", "get_next_post_with_ajax");
function get_next_post_with_ajax($args) {
echo "test";
die();
}
感谢您现在的帮助。
尝试为来自经过身份验证的用户的 ajax 次呼叫添加 add_action("wp_ajax_get_next_post_with_ajax", "get_next_post_with_ajax");
。
wp-admin ajax 无论我怎样尝试,请求总是给出 0 作为响应。我阅读了许多在 Google (including this in SOF) 中找到的解决方案、文章和答案,我相信我的代码是正确的。
我的ajax调用如下:
$.ajax( {
url : base_url
+ "/wp-admin/admin-ajax.php",
type : 'POST',
cache : false,
dataType : "json",
data: {action: "get_next_post_with_ajax"},
success: function(response){
// functions I'll work on success..
}
});
...我的 ajax 处理程序操作是这样的:
add_action("wp_ajax_nopriv_get_next_post_with_ajax", "get_next_post_with_ajax");
function get_next_post_with_ajax($args) {
echo "test";
die();
}
感谢您现在的帮助。
尝试为来自经过身份验证的用户的 ajax 次呼叫添加 add_action("wp_ajax_get_next_post_with_ajax", "get_next_post_with_ajax");
。