Pjax与Wordpress自定义主题在Firebug中产生301错误 [英] Pjax with wordpress custom theme giving 301 error in firebug

查看:115
本文介绍了Pjax与Wordpress自定义主题在Firebug中产生301错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在wordpress中使用pjax.但是,每当我尝试单击通过ajax调用获取内容的链接时,都没有任何反应,并且页面正常加载,firebug控制台显示301 aborted error.有人可以帮忙吗?

I am trying to use pjax in wordpress . but whenever I try to click the link which fetches the content via ajax call , nothing happens and page loads normally, firebug console show 301 aborted error . Any one can help ?

推荐答案

如果您在wordpress中使用ajax,请在theam的function.php文件中执行 action ,如下例所示

if you are using ajax in wordpress then make the action in function.php file of your theam , like below example

add_action('wp_ajax_do_ajax', 'our_ajax_function');
function our_ajax_function(){
     // now we'll write what the server should do with our request here
}

希望它会有所帮助:)

这篇关于Pjax与Wordpress自定义主题在Firebug中产生301错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆