I ran into a situation that I hadn't run into before. In my jQuery ajax function the result that was returned was the html code of a whole page. Not to fear, this is an error that should not be too hard to track. In my case, I used servlets and my servlet used the redirect function to redirect to another page after I had used the printwriter to return some html code to the ajax function.
The result was that the redirect function was redirecting to another page after the printwriter had written its result (so the printwriter's result was simply overwritten by the redirect method). Thus the ajax function received the html code of the whole page that the servlet had redirected to.
Check for similar functions (whether you are working in php, Perl, etc.). I have not run into this many times, but it makes sense that any similar case should have almost exactly the same cause.
Happy coding,
Hermann