From http://stackoverflow.com/questions/7373023/throttle-event-calls-in-jquery
$('#search').keyup($.debounce(function() { // Will only execute 300ms after the last keypress. }, 300));