Code
<script type="text/javascript">
$( "input[name='query']" ).keypress(function () {
var $this = $( this ),
form = $this.closest("form");
clearTimeout( this.timer );
this.timer = setTimeout(function () {
$this.next('#stip').remove();
$this.after( "<div id='stip' style='position: absolute; background: #FFFFFF; width: " + $this.width() + "px; left: " + $this.offset().left + "px;'>Загрузка…</div>" );
$.post("/" + form[0].action.split('/')[3], form.serialize(), function ( response ) {
var html = "";
$( "a.entryLink", response ).slice(0, 10).each(function () {
html += "<a href='" + this.href + "' target='_blank' style='float: left;color: #000000; font: normal normal 400 8px/8px Arial;'>" + this.innerHTML + "</a>
";
});
$this.next('#stip').remove();
$this.after( "<div id='stip' style='position: absolute; background: #FFFFFF; width: " + $this.width() + "px; left: " + $this.offset().left + "px;'>" + html + "</div>" );
});
}, 1000);
});
$(document).click(function (event) {
if ( !$(event.target).closest("#stip").length ) {
$("stip").remove();
}
});
</script>