If your use the returned data of an ajax call, you will find there is an unexpected extra 0 in the data. For example, if your action function is:
echo "hello world";
you will get “hello world0″.
This is because after myfunction is executed, there is some other code executed that outputs the extra 0. Specifically, the last line in admin-ajax.php is
die( '0' ); which outputs the extra 0.
To avoid this situation, you should use
wp_send_json("hello world") in myfunction() instead of using echo.