Jquery clear form after submission success : <p>Let's say we have a code like this:</p>

<pre><code>&lt;script type="text/javascript"&gt;
        $(document).ready(function() {
           $("#signup").click(function(e) {
             e.preventDefault();
                var email = $("#email").val();
                var fname = $("#fname").val();
                $.post("signup.php", {email:email, fname:fname}, function(data) {
                 $("#result").html(data);
                });
                return false;
            });
        });
    &lt;/script&gt; 
</code></pre>

<p>After clicking the submit button, we can get an error message
if the fields are not properly filled, in that case, the form can still
retain the values, but if "submission successful" message was returned,
how do I conditionally reset the form fields</p>
