I’ve been working in WordPress for more than a year, developing custom Themes and Plugins.
Ajax is commonly used in each of them. In general, most of us use
for returning JSON response in WordPress.
Wordpress 3.5 release introduced new functions for sending JSON responses:
These functions send a JSON response back to an AJAX request, whether successful or error, and die().
Well, you’ be wondering why to use them and I’d say there is no harm in following the WordPress standards. Also, I never knew that I’ve to set the headers too, until now, which I came to know from these functions.