Ah, no, strike the previous reply. I think the issue is that you include the _dbresults.php code, the search itself, but then call index.php (by leaving the url blank) from Ajax inside index.php.
When you call the code from Ajax, it calls the same page (as there's no separate URL) in the background, which then causes the search to be performed (because _dbresults.php will see a
$_POST variable), the results displayed, and then the rest of the original index.php to continue execution, which includes the display of the search box, all the CSS and so on. Because you called that via Ajax, all that output is grabbed, returned to the calling code as
responseText, which you then stick in the
I think what you need to do is to not include
_dbresults.php in your index.php file, just call it explicitly as in the commented-out line. I'm trying to learn JS, so this might be incorrect.