I am trying to add a JavaScript function setTimeout()to my jQuery expression. Without setTimeout()my function, it loads a partial view with updated information when entering text in a text field. But it loads information with every keystroke. My logic is that if I can set a timer, then when the user stops typing, a second later the data will be updated.
As you can see, I tried to fit setTimeout(), but it does not seem to work.
$(function() {
$('#DocId').live('keyup', function() {
setTimeout(var styleValue = $(this).val();
$('#tableContent').load(
'/CurReport/TableResults',
{ style: $(this).val()}), 1000);
}),
});
Thank,
Aaron
source
share