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
WPCasts
I hope you guys learned something! If you want to chat, follow me on Twitter: https://twitter.com/AlexanderBYoung
NAY CHO
Thank you ❤
Attila Balog
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!!!!!
Jitendra
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?
Greg Robinson
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.
Annie Dollie
Can you make live search for products with images result? I’m searching for many days but no one teach it
Ez Devv
it makes so much sense to have vs-code tools on the right
Rob Ruiz
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.
jasp zhy
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!
Khubbaib Naeem
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.
Lorenzo
very good tutorials. !! great job
Rodrigo Chaves
THANK YOU.
Daniel Kowalewski
….benchmarking using artillery… – o yeah! seatbelt fastened! 😀
Azizul Haque
What do you think of GraphQL? Is it better than all these 3?
Bill Woods
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?
Filip Van Reeth
What’s the vscode theme you used 🤪?
žan smolič
I wish there would be a beginner level video to this video, to understand what's you're saying better.
SubbaPdm
please make videos about ajaxing pages (single.php, page.php, archives etc )
Ragnar lodbrok
dude , ur voice like Jonah Hill
and thanks for tut
cheers from Egypt!!
manav budhia
Very good tutorial…. really helpful thanks for this great post.
When you are launching wordpress course ??
Maury Povich
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
ErrorError
TLDR; Rewrite API FTW!
Fucking awesome video dude, thank you for doing this, very helpful.
Apisit Mhungchomphu
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).
TheMarouuu
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!
Tuấn Trương
Thank you
msv [manikanta srivishnu]
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.