 <p>usea global js variable</p> <pre><code>var gblPreviousTxtBoxValue = $('#txtboxid').val(); </code></pre> <p>use setInterval function to call the function every 5 sec</p> <pre><code>setInterval(function(){ var currentTxtBoxValue =$("#your_id").val(); if(gblPreviousTxtBoxValue != currentTxtBoxValue) //check if current and previous textbox values are not equal { $.ajax({ url: "yoururl", type: "post", data: { "textboxname": currentTxtBoxValue }, success: function(response) { //Code }, error: function(xhr) { //Do Something to handle error } }); } gblPreviousTxtBoxValue = currentTxtBoxValue; //assign current value }, 5000); </code></pre>