#application.js
$(function() {
$("#contracts_search input").keyup(function() {
$.get($("#contracts_search").attr("action"), $("#contracts_search").serialize(), null, "script");
return false;
});
});
(function ($) {
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
$('input').keyup(function() {
delay(function(){
alert('here should be search method!');
}, 1000 );
});
})(jQuery);