Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Talk:AJAX in Plugins

Out of date suggestions

This document suggests using die(), but current WP seems to use wp_die(), which will eventually call _ajax_wp_die_handler() for simple responses.

More complex responses are being handled with wp_send_json() and its friends, wp_send_json_error() and wp_send_json_success().

Most of my code uses the old die() pattern here, but I'll update the main page when I have some text and examples in mind.

Misterbisson 15:51, 20 August 2014 (UTC)


You're right, these should be updated.
-Jdgrimes 19:23, 20 August 2014 (UTC)

Its 2015, Happy new year. Will you be updating the page soon?
- DanDare2050 (talk) 07:13, 2 January 2015 (UTC)

Done. It could still use a mention of the `wp_send_json*()` functions.
- Jdgrimes (talk) 14:48, 2 January 2015 (UTC)

Ajax is not AJAX

As I just wrote in AJAX: I'm going to be correcting usage: Ajax, not AJAX. Viz.:

"When Jesse James Garett had coined the term Ajax it was used in camel case. But due to its expansion coming into the limelight as “Asynchronous JavaScript and XML” (notice the uppercase of the words) people represented it as AJAX and not Ajax." [...]
"The reference of the usage is correctly attributed to the creator of the term itself i.e Jesse James Garette. He used Ajax (camel case). Wikipedia also uses in the same way, alongwith many big vendors, so it ought to be Ajax and not AJAX."
"Arun Gupta recalls his experience in making the changes at Sun Microsystems.
"Ajax is a popular term for past few months but is still being written incorrectly as “AJAX” (all capitals) instead of “Ajax” (camel case). I started using AJAX but then corrected myself and have been using Ajax since then."
Ajax Exposed from TechTracer.com

--bentrem 19:46, 9 February 2008 (UTC)


Added a link to my blog entry

Hi,

I added a link to my recent blog post about using Ajax in WordPress plugins and themes ( 5 tips for properly using Ajax in WordPress hemes and Plugins ). I'd like to stress that this is not any form of self-promotion.

If the editors don't find my article useful enough to include, feel free to remove it. No hard feelings :) But please do read the article before making any decisions.

Hi,

I just created a AJAX in WordPress QuickStart Guide. I found that there wasn't anything handy to get started quickly and AJAX can sometimes be finicky. I'm adding the link to the page; but, as above, I'd like to stress that this is not any form of self-promotion. Only, that I wish I had such a post when I was figuring it out myself. If the editors don't find my article useful enough to include, feel free to remove it.

Example broken?

Am I crazy or does the example not work as written?

Vynce 08:39, 22 April 2011 (UTC)

ajaxurl

DanDare2050 (talk) 07:21, 2 January 2015 (UTC)

"NOTE: Since Version 2.8, The JavaScript global variable ajaxurl can be used in case you want to separate your JavaScript code from php files into JavaScript only files. This is true on the administration side only."

This seems a bit cryptic. As I understand it the ajaxurl is the url to the instance of wordpress and the ajax call handling doohicky (technical term). How does that have anything to do with separating javascript code from php code? What am I missing?

Thinks.

Ok, you mean

"NOTE: Since Version 2.8, The JavaScript global variable ajaxurl has been loaded with the correct url for ajax calls to Wordpress. This means you may write pure javascript files that use this variable without having to pass it from some PHP generated code. This can be used in case you want to separate your JavaScript code from php files into JavaScript only files. This is true on the administration side only."

Less ambiguous?


Yes, that is what it is trying to say. -Jdgrimes (talk) 14:37, 2 January 2015 (UTC)