itguyme itguyme - 1 year ago 78
Ajax Question

Ajax show form after submit

i'm currently using the following ajax code to submit my form:


e.preventDefault(); // Prevent Default Submission

$.post('ajaxdmsgsub.php', $(this).serialize() )
$('#form-content').fadeOut('slow', function(){

alert('Ajax Submit Failed ...');


<div id="form-content">
<form method="post" id="reg-form" autocomplete="off" action="ajaxdmsgsform.php">

<textarea class="txtarea" name="message"></textarea>

<div class="cleared"></div>
<input type="submit" value="Submit Message" class="submitit" onclick="hide('myModal')">


after submit my form disappears, I want the form to reset so users can keep submitting without a refresh - i'm using this function like an instant messenger. but have no idea how to keep the form from disappearing.

Answer Source
$('#form-content').fadeOut('slow', function(){
   $('#form-content textarea, #form-content input').each(function(){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download