Hey guys,
I am using jQuery AJAX to submit a form. When the data has been validated successfully and processed, I want to clear the form, but I am unsure how. I have been trying to make it work for a few hours now. I am showing status messages in the container below:
<div id="resultContainer"></div>
When everything was successful, it looks like this:
- <div id="resultContainer">
- <div class="success" id="complete">Your registration was successful! However, you must activate your account before you can login. To do so, please check your e-mail address for further instructions.</div>
- </div>
And here is the simple code I use to clear the text fields:
- $('#usnam').val('');
- $('#pwd').val('');
- $('#pwdrep').val('');
- $('#mai').val('');
What I need is a way to check if everything was successful and if so, then run the code above. I tried to do it in a few ways, but it kept clearing regardless of the status.
Any ideas?
Thanks,
Andy