title: How do I reset a form in an ajax callback?
body: <p>I am sending a form using simple ajax and returning the results in a div above the form.  The problem is that after the form is submitted and validated, I display a thank you and want to reset the form so they don't just press the submit button again...  Can't seem to find the right code to do this...</p>
  
  <pre><code>&lt;form id="myForm" target="sendemail.php" method="post"&gt;
  &lt;div id="results"&gt;&lt;/div&gt;
  &lt;input type="text" name="value1"&gt;
  &lt;input type="text" name="value2"&gt;
  &lt;input type="submit" name="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>So, my sendemail.php validation errors and success messages appear in #results without problems.  </p>
  
  <p>But... when I try to send back a javascript form reset command, it does not work.  Naturally I cannot see it in the source code since it is an AJAX callback so I don't know if that is the issue or if I am just using the wrong syntax.</p>
  
  <pre><code>echo "&lt;p&gt;Thank you. Your message has been accepted for delivery.&lt;/p&gt;";
  echo "&lt;script type=\"text/javascript\"&gt;setTimeout('document.getElementById('myForm').reset();',1000);&lt;/script&gt;";
  </code></pre>
  
  <p>Any ideas gurus?</p>