title: Reset form after submit
body: <p>I am new with ajax and jquery.
  i have used the following code to submit form data it working fine.</p>
  
  <p>but i need to reset(clear form field) after submit form with all validation true.
  where to write a code to clear a form.</p>
  
  <p><strong>Html Form:</strong></p>
  
  <pre><code>&lt;form action="#" name="formdata" id="replyform" method="post"&gt;
      &lt;div class="pass-form"&gt;
          &lt;div class="input-row"&gt;
              &lt;div class="row_label"&gt;
                  Old Password
              &lt;/div&gt;
              &lt;span&gt;&lt;input type="text" id="User_pass1" name="User_pass1"/&gt;&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="input-row"&gt;
              &lt;div class="row_label"&gt;
                  New Password:
              &lt;/div&gt;
              &lt;span&gt;&lt;input id="User_pass2" name="User_pass2" type="password"/&gt;&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="input-row"&gt;
              &lt;div class="row_label"&gt;
                  Re-Enter New Password:
              &lt;/div&gt;
              &lt;span&gt;&lt;input id="User_pass3" name="User_pass3" type="password"/&gt;&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="input-row"&gt;
              &lt;div class="row_label"&gt;
                  &amp;nbsp;
              &lt;/div&gt;
              &lt;span&gt;&amp;nbsp;&lt;button name="chpass" onclick="submitform();" class="button" type="button" value="Save"&gt;Save&lt;/button&gt;
              &lt;button name="chpr" type="reset" class="button" value="Reset"&gt;Reset&lt;/button&gt;&lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Javascript function:</strong></p>
  
  <pre><code> function submitform() {
          var User_pass1 = document.getElementById("User_pass1").value.match("^\\S[0-9a-zA-Z.-]*$");
          var User_pass2 = document.getElementById("User_pass2").value.match("^\\S[0-9a-zA-Z.-]*$");
          var User_pass3 = document.getElementById("User_pass3").value.match("^\\S[0-9a-zA-Z.-]*$");
          //document.getElementById("User_pass1").value="";
          //document.getElementById("User_pass2").value="";
          //document.getElementById("User_pass3").value="";
          if (User_pass1 == null) {
              alert("password field Required.....!");
              return;
          } else if (User_pass2 == null) {
              alert(" New password  field Required.....!");
              return;
          } else if (User_pass3 == null) {
              alert("New password conformation field Required.....!");
              return;
          } else if (String(User_pass2) != String(User_pass3)) {
              alert("New password and  conformation not match....!");
              return;
          } else {
              var str = "User_pass1=" + User_pass1 + "&amp;User_pass2=" + User_pass2;
              $.ajax({
                  type: "POST",
                  url: _baseurl + "/setting/",
                  data: str,
                  success: function (output) 
                  {alert(output);}
              });
              return;
          }
      }
  </code></pre>