Skip to content Skip to sidebar Skip to footer

The Wordpress Ajax Request Returns 0

I can't figure out why nothing is returned I am a real beginner in Ajax .. I just read a lot of topics about using Ajax in Woprdpress but the examples are super advanced for me H

Solution 1:

You can't use return in your AJAX callback. The code never gets to die on the line beneath. You need to echo the value instead and then use wp_die().

Replace:

return $id;
die();

With:

echo $id;
wp_die();

Post a Comment for "The Wordpress Ajax Request Returns 0"