jQuery(function() {
$('input#searchbox').keypress(function(event) {
if (event.keyCode == 13) {
$("#btnsearchgo").click();
}
else if (event.keyCode == 8) {
search2();
}
else {
//get text from search box + last typed letter
v = $('input#searchbox').val() + String.fromCharCode(event.charCode);
//delay the calling of the function
clearTimeout($.data(this, 'timer'));
var wait = setTimeout(search, 300);
$(this).data('timer', wait);
}
});
function search() {
var e = document.getElementById("ddlExchange");
var x = e.options[e.selectedIndex].value;
//alert(v);
$.getJSON("somecode.aspx?code=" + x + "&src=" + v,
function(data) {
//alert(JSON.stringify(data));
$('input#searchbox').jsonSuggest(data, { maxResults: 8, onSelect: callback });
}
);
}
});
0 comments:
Post a Comment