Search code examples
jqueryajaxload

Why is a 0 being appended to the results of my ajax .load() call from jQuery?


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!


Solution

  • 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)?