I have accepted this solution as it would be a good one if I hade correctly diagnosed the problem in the first place. (I also would give it 5 stars but for some reason it only seems to allow me to select 4).
It actually turned out that the problem was not caused by a delay in response from the database after all, but simply down to the html not being hidden, emptied and shown at the correct times. But this was a very useful learning for me.
The solution was to add this into a function defined in a javascript file where the key press event in the text-box is handled, to avoid the previous valid search result being shown when a further key press means there are no search results:
$("#data-container".hide()
$("#data-container".empty()
where data-container is the html item which displays the search results from the database, defined in a .html file by:
I hope this makes sense to anyone else who may find this useful :)