使用 AJAX 加载 WordPress 页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2618422/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using AJAX to load WordPress pages
提问by Wade D Ouellet
I am trying to get it so that when a link is clicked in my WordPress template, it will load that page content with AJAX without changing the page. It needs to load dynamically into my content area depending on which link is clicked.
我正在尝试获取它,以便在我的 WordPress 模板中单击链接时,它将使用 AJAX 加载该页面内容而不更改页面。它需要根据点击的链接动态加载到我的内容区域。
I have never used AJAX before so I would love it if someone could help me out or point me in the right direction.
我以前从未使用过 AJAX,所以如果有人能帮助我或为我指明正确的方向,我会喜欢它。
Thanks,
谢谢,
Wade
韦德
采纳答案by markratledge
This plugin works and will give clues to how it works: WordPress ? AJAX Page Loader 1.5 ? WordPress Plugins
这个插件可以工作,并会给出它是如何工作的线索:WordPress ?AJAX 页面加载器 1.5 ?WordPress 插件
回答by circleatseven
I was unable to get that "AJAX Page Loader 1.5" plugin to work with the latest version of Wordpress (currently 3.1.2).. so I did MUCH digging around and found this tutorial "How To AJAXify WordPress Theme" which was super easy to follow and worked like a charm!
我无法让“AJAX Page Loader 1.5”插件与最新版本的 Wordpress(当前是 3.1.2)一起使用。所以我做了很多挖掘,发现了这个教程“如何 AJAX 化 WordPress 主题”,它非常简单跟随并像魅力一样工作!
回答by Justin Ethier
If you have access to jQuery, you could start by checking out their AJAX API Reference. There are plenty of examples in there, too!
如果您可以访问 jQuery,您可以从查看他们的AJAX API 参考开始。里面也有很多例子!

