Though many of the concepts in this course are still relevant, overall this course does not reflect our current course standards.

Check out a free preview of the full JavaScript for WordPress course:
The "Challenge 5: Ajax in WordPress" Lesson is part of the full, JavaScript for WordPress course featured in this preview video. Here's what you'd learn in this lesson:

In this challenge, students create a "Like this Site" plugin.

Get Unlimited Access Now

Transcript from the "Challenge 5: Ajax in WordPress" Lesson

>> Zac Gordon: Here's what we're doing. So, we're gonna make a Like This Site plugin and it saves likes as number in the wp_options table. Outside the scope of this course, but wp_options is kind of a free for all place to throw in small bits of data that you need.

[00:00:14] And wp_post_meta is another if you need it to be associated with the post, and you could do it that way. You don't wanna get carried away with options table, but for one entry with just the number of likes on the site, it's perfect. So, we'll display the total number of likes on the frontend, and when you click on a link, it increases the count with AJAX.

[00:00:32] And because not everybody is big on jQuery and because sometimes you'll need to run some AJAX using a different library that doesn't usually use jQuery. Like a lot of folks who use View, prefer Axios, then I have an example where you could do the exact same thing we do with jQuery just with the different library.

[00:00:51] Because how you set stuff up is slightly different. So, we'll do the jQuery together, and then on your own you could play with the Axios, and we'll kinda break at that point.