What is AJAX in WordPress? Meaning of AJAX

//What is AJAX in WordPress? Meaning of AJAX

AJAX stands for Asynchronous Javascript and XML. It is a collection of various web development techniques such as HTML, Cascading Style Sheet (CSS), JavaScript, XML (Extensible Markup Language), and JSON (JavaScipt Object Notation) to develop various web applications including WordPress.

Using AJAX you can make HTTP requests to the server and fetch back the processed data from the backend and display it on the web pages without the need to refresh the web page.

You might have seen the posts, images, videos loading automatically when you scroll down on your Facebook page or Twitter Page.

That’s AJAX.What is AJAX in WordPress? Meaning of AJAX

In WordPress, the AJAX plays a popular role in fetching the content dynamically on the blog post or pages without the need to refresh the page. It is also used to submit data or fetch data dynamically on page/post without reloading it.

Yes, WordPress has the AJAX support built into it and hence you don’t need to integrate it explicitly. AJAX can be used for front-end and back-end functionality – front-end for updating the content dynamically on the web page and back-end for fetching or processing data on the database (for example, MySQL).

How to use AJAX in WordPress (for developers)?

  • Create a Javascript file to make an AJAX request to admin-ajax.php (basically, you have to make your JavaScript code aware of the admin-ajax.php’s location). This is the file that processes AJAX requests in WordPress. A request needs to have at least one piece of data (using the GET or POST method). This is called Action.
  • Based on this Action, admin-ajax.php creates two hooks:
  • Add jQuery to submit the request
  • Define functions using the server side scripting language (PHP in case of WordPress) to fetch data from the database or to add/update/delete data from the MySQL database.

In general, AJAX can be used on WordPress to:

  • Submit form data without reloading the page.
  • Approve/Delete comments on a page without reloading the page.
  • Change the features of a Theme or Plugin without reloading the page.
  • Allow user actions like ‘Save Changes’ or do a ‘Vote’ without reloading the page.
WordPress Glossary – A to Z WordPress Terms and Meanings

List of “A to Z” WordPress Related Terms

2018-03-07T14:58:52+00:00

About the Author:

I love-to-code, passionate-to-write, an upcoming author, and WordPress enthusiast. Here at BlashO, I mostly share WordPress tips. Connect with me @Twitter.