In this video, I show you how to use admin-ajax.php, the REST API, and the Rewrite API to make AJAX calls. I also compare the three to see which is the fastest!
Link to the repository: https://github.com/alexander-young/3-ajax-methods
💖 Become a Patron to show support & get perks!
https://www.patreon.com/wpcasts
Sign up for the newsletter. Free course coming in 2020:
https://wpcasts.tv
**SOCIAL**
Twitter: https://twitter.com/AlexanderBYoung
Instagram: https://www.instagram.com/the_alex_young
Facebook: https://www.facebook.com/WPCasts.tv/
#WordPress #AJAX #Development
source
I hope you guys learned something! If you want to chat, follow me on Twitter: https://twitter.com/AlexanderBYoung
Thank you ❤
Thanks for the great tutorial, have to do some ajax request via admin-ajax, but i keep getting 403 forbidden. Couldn't fix for a day (i'm at work don't have too much time to debug properly).
The rest-api solution works for me.
BIG THANK YOU!!!!!
I copied your code in the themes folder and activated but I am still getting 404 errors when I click the submit button because of the routes.. How do I fix that?
Great video, thanks! @WPCasts – what's the extension or tool you're using at 11:01 to make the JSON appear neatly formatted and readable? Just curious, thanks.
Can you make live search for products with images result? I’m searching for many days but no one teach it
it makes so much sense to have vs-code tools on the right
Wow…never even heard of the rewrite api for Ajax. Guess I been under a rock. I don't understand regex very well, but seems I need to give it a shot. Never heard of artillery either. Bravo. That's some quality WP developer content. Hats off.
YES!! I have been using admin-ajax for so long but struggle to understand where does REST API come in, or what Rewrite API does
this really helped a lot! Thank you!
Sorry to say but never use /wp-admin/admin-ajax.php instead localize script using admin_url function so if some change wp-admin directory it will return correct one.
very good tutorials. !! great job
THANK YOU.
….benchmarking using artillery… – o yeah! seatbelt fastened! 😀
What do you think of GraphQL? Is it better than all these 3?
Nice tutorial!!! Good job, I’m a big fan! I have seen you work with the form submission often times, so just out of curiosity, is there any reason that you don’t use “wp-nonce” for the form submission?
What’s the vscode theme you used 🤪?
I wish there would be a beginner level video to this video, to understand what's you're saying better.
please make videos about ajaxing pages (single.php, page.php, archives etc )
dude , ur voice like Jonah Hill
and thanks for tut
cheers from Egypt!!
Very good tutorial…. really helpful thanks for this great post.
When you are launching wordpress course ??
if you do a headless WordPress do you still gotta write PHP code? Just curious how that works since the front-end that's displaying all the data is using javascript and an API.. I'm a jr so still wrapping my head around how things work. Also you seem to be very knowledgable with WP but your title at your job is frontend related, shouldn't you be considered fullstack? By the way thank you for all the content. You are paving your own path with this headless WordPress stuff. It really is the future
TLDR; Rewrite API FTW!
Fucking awesome video dude, thank you for doing this, very helpful.
I try to understand what you said because i'm still practice english and i work about wordpress with westerner( Thank you for share your knowledge).
42 people forgot to like the video so far. Cmon folks, give this dude some likes.
Too many beginner videos out there. We need intermediate knowledge like this. For free too!
Give this dude some support!
Thank you
1st like comment…thank u
AJAX stands for Asynchronous Javascript and XML but very few use XML today and more JSON. However, it is still referred to as AJAX In other words, I have used the wp_localize_script function to create a javascript object and the object is used in the path-to-js-file.js file mentioned in line 6.