tags:

views:

98

answers:

1

I'm using the .load() function in jquery to insert the results of a php file to an element. My code looks likethis:

$('#edit .postcontent').load('admin-ajax.php', {'action':'qe-getpost'});

Everything works great - the returned value is loaded into .postcontent perfectly. However, a 0 is appended to the end. Every time. Even if I return nothing, a lonely 0 shows up inside .postcontent. Can anyone explain what is going on?

Thanks!

+1  A: 

What content-type is admin-ajax.php returning? When you use Fiddler or some other debugging proxy to examine the actual content of the HTTP response, do you see the 0 there (or any other spurious characters)?

DDaviesBrackett
Heh.. Now I feel a little silly. I was using wordpress' built in ajax functionality, which enables you to use wordpress functions in your ajax response function - and a quick look at THAT code reveals that after every custom call, die('0') runs. Thanks for forcing me to look at the obvious..
Peter