I've been stuck on this topic for a while. I followed Pippin's tutorial . According to a 2nd wordpress developer who I got advice from, this tutorial is now out of date/ not appropriate.
He told me that I shouldn't
echo things in the AJAX callback.
wp_send_json()or the higher level functions
wp_send_json_error(). All of them will
diefor you. No need to
dieafterward, like Pippin has done it in his tutorial.
Which developer is correct? In the Codex, the example uses
echo in the callback, just like Pippin has in his tutorial.
Please can someone clarify? I've been getting conflicting advice & I'm confused by this topic.