Wordpress - Admin Ajax is returning 0

A 0 response means either that the action is not set (in the ajax data) or that the action's callback function cannot be found.


What you have to do is add die();at the end of your function.

See the reason and more here: http://codex.wordpress.org/AJAX_in_Plugins

Notes:

  • You should echo something before executing die. This will prevent server errors, and will help when debugging.

So I worked it out. It was not the jQuery as such though I have improved that, it was the placement of the call back function. I moved it over to the main plugin file and it worked.

Tags:

Ajax

Admin