WordPress.org

Ready to get started?Download WordPress

Forums

Trailing Zero with admin-ajax calls... (3 posts)

  1. jacobfogg
    Member
    Posted 5 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!

  2. Peter Butler
    Member
    Posted 5 years ago #

    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.

  3. tinwatchman
    Member
    Posted 4 years ago #

    Thanks for the advice, peterebutler. That was driving me crazy.

Topic Closed

This topic has been closed to new replies.

About this Topic