Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed to change code to periodically execute (autosave)
    text
    copied!<p>This is working code. If click button, code executes</p> <pre><code>$(document).ready(function() { $("#register").click(function(){ if ($("#is_row_changed1").val() &gt; 0) { $.post( "_autosave.php", $("#form1").serialize(), function(data) { $('#load').html(data); document.getElementById('is_row_changed1').value = 0; }//function(data) { );//$.post( //var str = $("#form1").serialize();//this will display in #stage2 all input values like date_day1=22&amp;date_month1=04 //$("#stage2").text(str); }//if ($("#is_row_changed1").val() &gt; 0) { });//$("#register").click(function(event){ });//$(document).ready(function() { </code></pre> <p>I need it execute periodically, for example each 5 seconds</p> <p>If <code>$(document).ready(function() {</code> change to <code>function autosave() { var t = setTimeout("autosave()", 5000);</code> nothing happens.</p> <p>What would be correct code?</p> <p><strong>Update</strong> Seems got working code. Please, any comments (may be something incorrect/not good)</p> <pre><code>$(document).ready(function() { $(function() { setTimeout(autoSavePost, 5000); }); function autoSavePost() { //$("#register").click(function(){ if ($("#is_row_changed1").val() &gt; 0) { $.post( "_autosave.php", $("#form1").serialize(), function(data) { $('#load').html(data); document.getElementById('is_row_changed1').value = 0; }//function(data) { );//$.post( //var str = $("#form1").serialize();//this will display in #stage2 all input values like date_day1=22&amp;date_month1=04 //$("#stage2").text(str); }//if ($("#is_row_changed1").val() &gt; 0) { setTimeout(autoSavePost, 5000); }//function autoSavePost() { //});//$("#register").click(function(event){ });//$(document).ready(function() { </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload