jacobfogg
Member
Posted 3 years ago #
I have started using the admin-ajax to make my admin panel pretty. The problem I am finding is that all of my Ajax calls are coming back with trailing 0's
It doesn't matter what I am requesting, or even if I am making a valid request... it always returning a 0.
I have disabled all but this plugin I am building and have looked over all of my code and I am still getting this 0.
Is this expected behavior?
any help would be appreciated!
I just fought with this problem for an hour before finding the (fairly) obvious solution. When you run a custom call through admin-ajax (actually, when you run almost any call through admin-ajax), after your function is run, the file executes this:
die('0');
killing execution and appending that infuriating 0. I'm sure this is for a purpose, I just haven't taken the time to figure out what it is. to get around it, I run
die();
at the end of my function calls.
tinwatchman
Member
Posted 2 years ago #
Thanks for the advice, peterebutler. That was driving me crazy.