Every AJAX requests pass through the admin-ajax.
...
How to use AJAX precisely in WordPress Custom Themes?
- Step 1: Create a template file and put below code into your file. ...
- Step 2: Localize your script into functions.php.
- Step 3: Add function that load posts into functions. ...
- Step 4: Place your AJAX JS into ajax.