Skip to content

Instantly share code, notes, and snippets.

@saltybeagle
Created March 29, 2010 23:49
Show Gist options
  • Save saltybeagle/348568 to your computer and use it in GitHub Desktop.
Save saltybeagle/348568 to your computer and use it in GitHub Desktop.
var searching = false;
var search_string = '';
$('#courseSearch').keyup(
function(){
if (this.value.length > 2) {
if (search_string != this.value) {
search_string = this.value;
clearTimeout(searching);
WDN.jQuery('#courseSearchResults').html('<img src="/wdn/templates_3.0/css/header/images/colorbox/loading.gif" alt="Loading search results" />');
searching = setTimeout(function(){fetchCourseSearchResults(search_string);}, 750);
}
} else {
WDN.jQuery('#courseSearchResults').html('');
}
}
);
function fetchCourseSearchResults(q)
{
WDN.get(UNL_UGB_URL+'courses/search?q='+escape(q)+'&format=partial', null, function(content){WDN.jQuery('#courseSearchResults').html(content);});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment