title: Auto save form field inputs using jquery and ajax
body: <p>I have a form with different input fields.So for very minute , the data entered by the user needs to be automatically stored in the database. Once the request is submitted , it will be directed to the struts file where the database interactions will be carried out .</p>
  
  <p>What i have tried, I had set the timeout function to run every time the page is loaded </p>
  
  <pre><code>var timer;
  $(document).ready(function() {
  timer = setTimeout("autosave()", 60000); 
  });
  </code></pre>
  
  <p>And in the autosave function , i am trying to post the input data to the designated URL</p>
  
  <pre><code>jQuery('form').each(function() {
          jQuery.ajax({
              url: "http://localhost:7002/submitStudent.do?requestType=auto&amp;autosave=true",
              data: jQuery(this).serialize(),
              type: 'POST',
              success: function(data){
                  if(data &amp;&amp; data == 'success') {
                      alert("data saved");
                  }else{
                  }
              }
          }); 
      }); 
  }
   }
  </code></pre>
  
  <p>And once the request is sent to the struts , it will be processed based on the requesttype and the data will be submitted.</p>
  
  <p>But in my case , data doesn't get saved.</p>
  
  <p>Kindly share your suggestions on what i am doing wrong and any other ways to do it ?</p>
  
  <p>Thanks for your valuable suggestion and time..   </p>
  
  <p>FYI , i am a beginner in Jquery and ajax technologies</p>
  
  <p>JSFIDDLE : <a href="http://jsfiddle.net/jegadeesb/o0c3rmp3/1/" rel="nofollow">jsfiddle</a></p>