Introduction to AJAX in WordPress

AJAX is an abbreviation for Asynchronous JavaScript And XML. This technology allows us to sent and retrieve data without refreshing the browser. So, the execution of repetitive tasks such as multiple file uploading can be simplified by using AJAX. Usually, we use a direct URL to execute AJAX requests. However, WordPress offers a built-in interface for executing AJAX requests and it's recommended to use this technique without using our own AJAX handlers.

WordPress uses a file called admin-ajax.php for handling requests, and the file is located inside the wp-admin directory. This file contains the necessary code for built-in core AJAX requests as well as code for supporting custom requests through actions

Get WordPress Development Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.