I have some ajax code that updates a doc in the db
// Updates to INPUTS, on.input..
jQuery(function ($) {
$(document).on('input', '.updateThisClass', function () {
var $this = $(this);
var number = $this.data('id');
console.log("index # of doc updated: " + number);
//THIS IS LOGGED WITH EVERY CHARACTER ENTERED
// make an ajax call
$.ajax({
dataType: 'json',
data: $('#theForm' + number).serialize(),
type: 'POST',
url: "http://localhost:9999/update",
success: gotAllSuccess,
error: gotAllFailure
});
});
})
.input is too fast though, and updates on every single character!
How can a Timer be added to the .input part of this function? Or is there an event for multi-char-inputs?