WordPress's Hidden Gem: The wp.ajax Utility #382
Replies: 3 comments
-
Looks really interesting, @andreilupu ! Just going through the examples, the only "first glance" suggestion I have would be to replace any jQuery (e.g. I'd also look for an example on how this could be included in a custom block for ajax calls there. Can it be imported and compiled, e.g., Looking forward to the finished product! |
Beta Was this translation helpful? Give feedback.
-
Hey @n8finch, thanks for the feedback. I intentionally used the jQuery version because it made the code look "longer." By comparing it with the This utility comes from this file, which means that the utility is available only via the global variable I can think about an example of a custom block that uses it, it could be something that needs a server-side Ajax callback, something that returns a piece of data. |
Beta Was this translation helpful? Give feedback.
-
The topic was approved and conversation moved to this issue |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
I'm proposing the following topic as an article about the
wp.ajax
utility.The majority of WordPress developers are not aware of this tool that could cut the number of lines for a simple Ajax code from 15 lines to 3.
I'll leave the draft here for feedback. I'm pretty sure there are things to improve.
https://docs.google.com/document/d/1kwmd3rpWuHRBVtCaTnxa0mVz1Z89QzqiUZMhY6Ugd1g/edit?usp=sharing
Beta Was this translation helpful? Give feedback.
All reactions