Unless I end Ajax processing function by exit()
or die()
, the Ajax function receives desired and correct output but following by 0
.
Any idea why is that happening?
Is that meant to be like that or it could be fixed?
add_action('wp_ajax_get_homepage', 'get_homepage');
add_action('wp_ajax_nopriv_get_homepage', 'get_homepage');
function get_homepage(){
echo "get_homepage ->";
exit();
}
I’ve read at AJAX in Plugins, but why is that necessary?