Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using AJAX to load WordPress pages

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.

I have never used AJAX before so I would love it if someone could help me out or point me in the right direction.

Thanks,

Wade

like image 623
Wade D Ouellet Avatar asked Apr 11 '10 19:04

Wade D Ouellet


People also ask

Is AJAX used in WordPress?

Since WordPress uses Ajax by default in the admin dashboard, adding more Ajax functionality there is not difficult. If you want to use Ajax on the front end of your site, however, you will need to understand how the Ajax URL works. In WordPress, your admin-ajax. php file has a URL.

Is AJAX used to load data?

The acronym AJAX stands for Asynchronous JavaScript and XML and is used to display data on the web page and load this data in the background (on the server), without having to reload the entire page.

How do I get AJAX response in WordPress?

In WordPress, we send all AJAX request to a common URL, then wordpress internally calls the corresponding method according to the parameters which we have sent with the request. You can use the admin_url( 'admin-ajax. php' ) function of WordPress to get this url.


2 Answers

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!

like image 137
circleatseven Avatar answered Nov 13 '22 11:11

circleatseven


This plugin works and will give clues to how it works: WordPress › AJAX Page Loader 1.5 « WordPress Plugins

like image 22
markratledge Avatar answered Nov 13 '22 11:11

markratledge