How to save data only when data is present in the form?
<p>I have this code where I am trying to save data every 5 seconds, only there is data in the form. But when the page loads, the "Form Saved" message appears after an interval of 5 seconds. And it does not appear after that at all, whether data is present in form or not</p>

<pre><code>    $(document).ready(function () {
        $(":input").each(function() {
            if($(this).val() !== "") 
                window.setInterval(saveData, 5000);
        }); 
    });

    function saveData(){
       $.ajax({
           type: 'POST',
           url: "SaveDraft.aspx",
           data: {
               name: $('#frmTaxSheet').serialize()
           },
           cache: false,
           error: function(xhr, status, errorThrown) {
               alert(errorThrown + '\n' + status + '\n' + xhr.statusText);
           },
           success: function(response) {
                $('#notify').text("Form Data Saved").fadeOut(2000, function() { 
                    $(this).remove();
                });
            ;}
       });
    }
</code></pre>

<p>How can I fix this?</p>
