Join Morten Rand-Hendriksen for an in-depth discussion in this video Create a basic AJAX function using the WP-API, part of WordPress REST API (WP-API): First Look (2015).
And the URL we already grabbed previously.…It is this JSON URL up here,…and that's it.…Now AJAX will grab our JSON UIRL and parse it as JSON.…Now, of course, we have to do something…with what comes out of this.…So I'm going to set up three catches here.…I'll start with .done(function),…and this function I'm going to call it response.…Then I'm going to have fail…in case something goes horribly wrong.…
And then I'm going to have always,…and that runs at the end regardless…of whether or not it passed or failed,…and then finally I'll close my AJAX function.…
With the WP API, developers can access the data on a WordPress site—such as users, posts, and categories—programmatically. The result is an expansion of the already limitless field of possibilities where theme and plugin development is concerned.
This course is a first look at the WP API: what it is, how to get it running, how to interact with it, what it can do for us, and what we can do with it. Join Morten Rand-Hendriksen, your guide and WordPress guru, as he walks through the tools and major features (such as routes and endpoints) of the WP API, as well as a short project that shows how this new API will be used in real-world workflows.
- Installing the WP API
- Exploring common routes
- Examining WP API output
- Building plugins with the WP API
- Crafting WP API URL requests
- Creating AJAX functions with the WP API