Use of "setTimeout()" in my jQuery Expression
- by Aaron Salazar
I'm trying to add the JavaScript function setTimeout() to my jQuery expression. Without the setTimeout() my function loads a partial view with updated information when I enter text into my textbox. But, it loads the information with every keystroke. My logic is that if I can put in a timer then when the user stops typing, a second later the data is updated.
As you can see I tried to put a setTimer() in but it doesn't seem to be working.
$(function() {
$('#DocId').live('keyup', function() {
setTimeout(var styleValue = $(this).val();
$('#tableContent').load(
'/CurReport/TableResults',
{ style: $(this).val()}), 1000);
}),
});
Thank you,
Aaron