Ajax in WordPress is one of those APIs that’s easy to work with (assuming you understand the fundamentals).

A highly technical illustration of Ajax.
For the most part, it’s as simple as:
- Defining a function on the server-side and hooking it to the proper WordPress hook,
- Setting up JavaScript to make a
POSTor aGETrequest to the particular function, - Handling the response on the client-side once the function as returned it.
Sure, there are things like localization and security that matter but they aren’t as difficult to implement as you might think. These topics are outside the focus of this post, though.
Instead, one of the things that I usually implement is a simple protocol of sorts to help when handling response information from the server.
In short, I’m talking about the idea of using a protocol, of sorts, when using Ajax in WordPress. And it sounds like a more complicated concept than it is.



