你知道为什么这个简单的 wp ajax 查询不起作用吗?它总是返回失败。控制台-> https://pastebin.com/TABQCjXe
jQuery(document).ready(function($) {
// This does the ajax request
$.ajax({
type: 'post',
url: ajaxurl,
data: {
'action':'prefix_load_cat_posts'
},
success:function(data) {
// This outputs the result of the ajax request
console.log(data);
$( ".prefix_load_cat_posts" ).append("success");
},
error: function(errorThrown){
console.log(errorThrown);
$( ".prefix_load_cat_posts" ).append("fail");
}
});
});