javascript - ajax not posting form variables -


i have form uses ajax post variables php handler. now, what's weird on same page have couple of other forms work correctly (and more echo variables). work correctly , doing things same, reason 1 won't. can spot error? also, actual request successful, because if put echo in php, returned console.log in success callback.

form:

<div class="doctor_register" >                     <form id = 'doctor_register' method ='post'>                     <input type ='hidden' name ='type' value='doctor'>                     <input type ='hidden' name='act' value='create'>                 <table>                     <tbody>             <br></br>                      <tr>                         <td><input type="text" name ='first_name' size='8' placeholder='first name'/></td>                          <td><input id ='last_name'type="text" name = 'last_name' size='8' placeholder ='last name'/></td>                     </tr>                     <br></br>                      <tr>                         <td><input class='register_inputs' type="text" name='user_name' placeholder='username' size='14'/></td>                      </tr>                      <tr>                         <td><input class='register_inputs' type="text" name='email' placeholder='email'size='14' /></td>                      </tr>                 <tr></tr>                     <tr>                         <td><input class='register_inputs' type="password" name='user_password1' placeholder='password' size='14' /></td>                     </tr>         <tr></tr>                     <tr>                         <td><input class='register_inputs' type="password" name='user_password2' placeholder='confirm password' size='14' /></td>                      </tr>                                 <td>     <table>     <tr>         <td><img id="captcha_image" src="modules/captcha/securimage_show.php?sid=<?php echo md5(uniqid(time())); ?>"></td>         <td>             <a href="modules/captcha/securimage_play.php"><img style="padding:0px; margin:0px; border:0px;" id="captcha_image_play" src="modules/captcha/images/audio_icon.gif" title="<?php echo _play; ?>" alt="<?php echo _play; ?>" /></a><br />             <img style="cursor:pointer;padding:0px;margin:0px;border:0px;" id="captcha_image_reload" src="modules/captcha/images/refresh.gif" style="cursor:pointer;" onclick="document.getelementbyid('captcha_image').src = 'modules/captcha/securimage_show.php?sid=' + math.random(); appsetfocus('frmreg_captcha_code'); return false;" title="<?php echo _refresh; ?>" alt="<?php echo _refresh; ?>" />         </td>     </tr>     <tr>         <td colspan="2">             <input type="text" id="frmreg_captcha_code" name="captcha_code" style="width:148px;" maxlength="20" value="" autocomplete="off" />         </td>     </tr>     </table> </td>             <tr></tr>                     <tr>                         <td><input type='submit' name ='submit' ></td>                         <td><a href="#" class="back_doctor_login">back</a></td>                     </tr>                 </table>                 </form>             </div> 

javascript:

   <script>      $('#doctor_register').on("submit",function(){       frmreg = document.getelementbyid("doctor_register");       if(frmreg.first_name.value == "")          { alert("<?php echo _first_name_empty_alert; ?>");  frmreg.first_name.focus(); return false;     }else if(frmreg.last_name.value == "")     { alert("<?php echo _last_name_empty_alert; ?>"); frmreg.last_name.focus(); return false;     }else if(frmreg.email.value == "")         { alert("<?php echo _email_empty_alert; ?>"); frmreg.email.focus(); return false;     }else if(!appisemail(frmreg.email.value))  { alert("<?php echo _email_valid_alert; ?>"); frmreg.email.focus(); return false;     }else if(frmreg.user_name.value == "")     { alert("<?php echo _username_empty_alert; ?>"); frmreg.user_name.focus(); return false;     }else if(frmreg.user_password1.value == ""){ alert("<?php echo _password_is_empty; ?>"); frmreg.user_password1.focus(); return false;     }else if(frmreg.user_password2.value == ""){ alert("<?php echo _conf_password_is_empty; ?>"); frmreg.user_password2.focus(); return false;     }else if(frmreg.user_password1.value != frmreg.user_password2.value){ alert("<?php echo _conf_password_match; ?>"); frmreg.user_password2.focus(); return false;     }else if(frmreg.captcha_code.value == "")  { alert("<?php echo _image_verify_empty; ?>"); frmreg.captcha_code.focus(); return false;     }else {      $.ajax({     type : 'post',     url: '../doctor/handlers/handler_ajax_handler.php',     data: $('#doctor_register').serialize,     success: function(e){ console.log(e);},     error: function(){ alert('error');}     });      }      });   </script> 

php:

print_r($_post); 


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -