Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery ajax simple form must show the form along with additional content
    primarykey
    data
    text
    <p>so i started using jquery with ajax.. all is good..The form is submitted.. but after the response the form disappears and only the output is on screen.. i tried </p> <pre><code>success: function(html) { $(".result").html(html); } </code></pre> <p>i used the show options,but my form doesn't come back..</p> <pre><code>$('#myform').show() </code></pre> <p>what must i do, to display the current div and additional div(after ajax success).. hope am clear with this.. Any help appreciated... And big huge thanks to all members of SO of helping poor newbiess like me.. Thanks in advance.. my code my script </p> <pre><code>$(document).ready(function(){ $("#form1").validate({ debug: false, rules: { passwordid:"required", username:"required", password_again :"required", password_again:{ equalTo: "#passwordid" }, email: { required: true, email: true } }, messages: { email: "Please enter your valid email address.", username: "Please enter your username", passwordid:"Enter Password", password_again:"Please enter the same value", }, submitHandler: function(form) { $.ajax ({ type: "POST", url: "new.php", data: $('#form1').serialize(), cache: false, success: function(html) { $(".result").html(html); } }); } }); }); </code></pre> <p><strong>My long form:</strong></p> <pre><code>//my result class &lt;div class="result"&gt;&lt;div&gt; &lt;div id="wrapper"&gt; &lt;form name="form1" id="form1" action="" method="post"&gt; &lt;b&gt; Create New Account &lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;label for="username" id="username_label"&gt;Username&lt;/label&gt;&lt;br&gt; &lt;input id="username" type="text" name="username"/&gt;&lt;br&gt; &lt;label for="passwordid" id="password_label"&gt;Password&lt;/label&gt;&lt;br&gt; &lt;br&gt; &lt;input type="password" name="passwordid" id="passwordid" size="35"&gt; &lt;br&gt;&lt;br&gt; &lt;label for="password_again" id="password_again_label"&gt;Re-Type Password&lt;/label&gt;&lt;br&gt; &lt;br&gt;&lt;input type="password" name="password_again" id="password_again" size="35"&gt; &lt;br&gt; &lt;b&gt;Personal Details&lt;/b&gt;&lt;br&gt;&lt;br&gt; &lt;label class="r" for="firstname" id="firstname_label"&gt;First Name&lt;br&gt; &lt;input type="text" name="firstname" id="firstname" size="35"&gt;&lt;/label&gt;&lt;br&gt;&lt;br&gt; &lt;label class="r" for="lastname" id="lastname_label"&gt;Last Name&lt;br&gt; &lt;input type="text" name="lastname" id="lastname" size="35"&gt;&lt;/label&gt;&lt;br&gt;&lt;br&gt; Gender&lt;br&gt;&lt;br&gt; &lt;select class="cc" name="sex" id="sex"&gt; &lt;option value="" selected="selected"&gt;--Select Gender--&lt;/option&gt; &lt;option value="m"&gt;Male&lt;/option&gt; &lt;option value="f"&gt;Female&lt;/option&gt; &lt;/select&gt; &lt;br&gt;&lt;br&gt; Date of birth&lt;br&gt; &lt;label class="dob" for="dateid" id="date_label"&gt;Date &lt;?php $number = range(1,31); $tempholder = range(1,31); $nr=31; echo '&lt;select class="doba" name="dateid" id="dateid"&gt;'; echo '&lt;option value="" selected="selected"&gt;--Select Date--&lt;/option&gt;'; for ($i=0; $i&lt;$nr; $i++) { echo "&lt;option&gt;".$tempholder[$i]."&lt;/option&gt;"; } echo '&lt;/select&gt;'; ?&gt; &lt;/label&gt; &lt;label class="dob" for="month" id="month_label"&gt;Month &lt;?php $number = range(1,12); $tempholder = range(1,12); $nr=12; echo '&lt;select class="doba" name="month" id="month"&gt;'; echo '&lt;option value="" selected="selected"&gt;--Select Month--&lt;/option&gt;'; for ($i=0; $i&lt;$nr; $i++) { echo "&lt;option&gt;".$tempholder[$i]."&lt;/option&gt;"; } echo '&lt;/select&gt;'; ?&gt; &lt;/label&gt; &lt;label class="dob" for="year" id="year_label"&gt;Year &lt;?php $tempholder = range(1960,2000); $nr=40; echo ' &lt;select class="doba" name="year" id="year"&gt;'; echo '&lt;option value="" selected="selected"&gt;--Select Year--&lt;/option&gt;'; for ($i=0; $i&lt;$nr; $i++) { echo "&lt;option&gt;".$tempholder[$i]."&lt;/option&gt;"; } echo '&lt;/select&gt;'; ?&gt; &lt;/label&gt; &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;b&gt;Contact Details&lt;/b&gt; &lt;br&gt;&lt;br&gt; &lt;label for="add1" id="add1_label"&gt;Address1&lt;/label&gt;&lt;br&gt; &lt;input id="add1" type="text" name="add1"/&gt;&lt;br&gt; &lt;label for="add2" id="add2_label"&gt;Address2&lt;/label&gt;&lt;br&gt; &lt;input id="add2" type="text" name="add2"/&gt;&lt;br&gt; &lt;label for="add3" id="add3_label"&gt;Address3&lt;/label&gt;&lt;br&gt; &lt;input id="add3" type="text" name="add3"/&gt;&lt;br&gt; &lt;label for="mobile" id="mobile_label"&gt;Mobile&lt;/label&gt;&lt;br&gt; &lt;input id="mobile" type="text" name="mobile"/&gt;&lt;br&gt; &lt;label for="tele" id="tele_label"&gt;Telephone&lt;/label&gt;&lt;br&gt; &lt;input id="tele" type="text" name="tele"/&gt;&lt;br&gt; &lt;label for="email" id="email_label"&gt;E-mail&lt;/label&gt;&lt;br&gt; &lt;input id="email" type="text" name="email"/&gt;&lt;br&gt; &lt;br&gt; &lt;b&gt;Card Details&lt;/b&gt;&lt;br&gt;&lt;br&gt; &lt;label for="cardno" id="cardno_label"&gt;Card No&lt;/label&gt;&lt;br&gt; &lt;input id="cardno" type="text" name="cardno"/&gt;&lt;br&gt; &lt;label for="cvcno" id="cvcno_label"&gt;CVC No&lt;/label&gt;&lt;br&gt; &lt;input id="cvcno" type="text" name="cvcno"/&gt;&lt;br&gt; &lt;br&gt; &lt;select name="cardtype" id="cardtype"&gt; &lt;option value="" selected="selected"&gt;--Card Type--&lt;/option&gt; &lt;option value="visa"&gt;Visa&lt;/option&gt; &lt;option value="master"&gt;Master&lt;/option&gt; &lt;option value="american"&gt;American Express&lt;/option&gt; &lt;/select&gt;&lt;br&gt;&lt;br&gt; Expiry Date&lt;br&gt;&lt;br&gt; &lt;label class="dob" for="dateid1" id="date_label"&gt;Date &lt;?php $number = range(1,31); $tempholder = range(1,31); $nr=31; echo '&lt;select class="doba" name="dateid1" id="dateid1"&gt;'; echo '&lt;option value="" selected="selected"&gt;--Select Date--&lt;/option&gt;'; for ($i=0; $i&lt;$nr; $i++) { echo "&lt;option&gt;".$tempholder[$i]."&lt;/option&gt;"; } echo '&lt;/select&gt;'; ?&gt; &lt;/label&gt; &lt;label class="dob" for="month1" id="month_label"&gt;Month &lt;?php $number = range(1,12); $tempholder = range(1,12); $nr=12; echo '&lt;select class="doba" name="month1" id="month1"&gt;'; echo '&lt;option value="" selected="selected"&gt;--Select Month--&lt;/option&gt;'; for ($i=0; $i&lt;$nr; $i++) { echo "&lt;option&gt;".$tempholder[$i]."&lt;/option&gt;"; } echo '&lt;/select&gt;'; ?&gt; &lt;/label&gt; &lt;label class="dob" for="year1" id="year_label"&gt;Year &lt;?php $tempholder = range(2013,2053); $nr=40; echo ' &lt;select class="doba" name="year1" id="year1"&gt;'; echo '&lt;option value="" selected="selected"&gt;--Select Year--&lt;/option&gt;'; for ($i=0; $i&lt;$nr; $i++) { echo "&lt;option&gt;".$tempholder[$i]."&lt;/option&gt;"; } echo '&lt;/select&gt;'; ?&gt; &lt;/label&gt; &lt;br&gt;&lt;br&gt; &lt;input type="submit" class="ss" value="SUBMIT" class="left" &gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload