Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Every time I do a particular Ajax request at the end of the result I get a 0. Why am I getting this and is there a way to get rid of it?

The result is good it's just followed by a zero for some reason.

share|improve this question
    
You will need to add some of your code to get more help –  Douglas.Sesar Apr 9 at 21:05
2  
Put a die() at the end of the script –  Andrew Bartel Apr 9 at 21:15
    
I just did. I got tired to looking around. –  jnbdz Apr 9 at 21:33

1 Answer 1

up vote 1 down vote accepted

WordPress does that by default at the end of admin-ajax.php. It kind of assumes you'll use one of wp_send_json(), wp_send_json_success(), or wp_send_json_error() to communicate your process' state (or at least terminate the script yourself). All of those use wp_die() to terminate the script after sending the response. It's sort of a catch-all response.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.