Note that there are some explanatory texts on larger screens.

plurals
  1. POAJAX call works in Chrome and Safari but not in Firefox and IE?
    text
    copied!<p>This is my code to reset a user's password incase the user forgets his password. The data is sent to the PHP code via AJAX requests and the PHP code simply echoes a "Y" or "N" depending upon the validity of the inputs.</p> <p>The problem is, the AJAX calls does not work in Firefox 19 and IE 9. I haven't tried in other versions of IE. The AJAX calls work perfectly in chrome and safari. Has anyone been through the same problem? Can anyone help please?</p> <p> </p> <pre><code> &lt;title&gt; Forgot Password? &lt;/title&gt; &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://jzaefferer.github.com/jquery- validation/jquery.validate.js"&gt;&lt;/script&gt; &lt;style type="text/css"&gt; label.error { color: red; } #status { color: green; } &lt;/style&gt; &lt;script&gt; $(document).ready(function(){ $('#code_form').hide(); $('#password_form').hide(); $("#email_form").validate({ onkeyup: false, rules: { email: { required: true, email: true } }, messages: { email: { required: "Please enter your email ID.", email: "Please enter a valid email ID." } } }); $('#email_send').click(function() { event.preventDefault(); var email = $('#email').val(); $.ajax({ type: "POST", url: "reset_code.php", data: {email: email}, cache: false, success: function(response){ if(response == "Y") { $('#code_form').show(); $('#email_send').hide(); $('#status').html("Check your mail for the reset code."); } else { $('#status').html("Looks like you have entered a wrong email ID."); } } }); }); $("#code_form").validate({ onkeyup: false, rules: { code: { required: true, digits: true } }, messages: { code: { required: "Please enter the code received in your mail.", digits: "Please enter the code received in your mail." } } }); $('#code_send').click(function() { event.preventDefault(); var email = $('#email').val(); var code = $('#code').val(); $.ajax({ type: "POST", url: "code_verify.php", data: {email: email, code: code}, cache: false, success: function(response){ if(response == "Y") { $('#password_form').show(); $('#code_send').hide(); $('#status').html("Ok, now enter your password twice before you forget again."); } else { $('#status').html("Please enter the code received in your mail."); } } }); }); $("#password_form").validate({ onkeyup: false, rules: { password: { required: true, minlength: 8 }, repassword: { required: true, equalTo: "#password" } } }); $('#password_send').click(function() { event.preventDefault(); var email = $('#email').val(); var password = $('#password').val(); var repassword = $('#repassword').val(); $.ajax({ type: "POST", url: "update_password.php", data: {email: email, password: password, repassword: repassword}, cache: false, success: function(response){ if(response == "Y") { $('#email_form').hide(); $('#code_form').hide(); $('#password_form').hide(); $('#status').html("Password reset successful. Proceed to &lt;a href=index.php&gt;login&lt;/a&gt; page. "); } else { $('#status').html("Oops. Something went wrong. Try again."); } } }); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body class="oneColElsCtr"&gt; &lt;div class ="about_body"&gt; &lt;a href="index.php"&gt;&lt;img src="images/title_block_logon.png" style="margin- top:25px; margin-bottom:-10px;"/&gt;&lt;/a&gt;&lt;br/&gt; &lt;div id="status" class="alert alert-success" style="margin-top:20px; width:400px; margin-left:235px; margin-bottom:30px;"&gt; &lt;h4 class="alert-heading"&gt; Reset your password &lt;/h4&gt; &lt;/div&gt; &lt;form class="form-horizontal" name="email_form" id="email_form" method="POST" action="" &gt; &lt;fieldset&gt; &lt;div class="control-group" style="margin-left:230px"&gt; &lt;label class="control-label"&gt;Email&lt;/label&gt; &lt;div class="controls" align="left"&gt; &lt;input name="email" id="email" class="input-large" type="text" placeholder="Enter your Email id"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;button type="submit" id="email_send" class="btn btn-inverse submit"&gt;GO&lt;/button&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;form class="form-horizontal" name="code_form" id="code_form" method="POST" action="" &gt; &lt;p&gt;Enter the code received in your Email&lt;/p&gt; &lt;fieldset&gt; &lt;div class="control-group" style="margin-left:230px"&gt; &lt;label class="control-label"&gt;Code&lt;/label&gt; &lt;div class="controls" align="left"&gt; &lt;input name="code" id="code" class="input-large" type="text" placeholder="#####"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;button type="submit" id="code_send" class="btn btn-inverse submit"&gt;GO&lt;/button&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;table style="text-align:left"&gt; &lt;tr&gt; &lt;td width="60%"&gt; &lt;form class="form-horizontal" name ="password_form" id="password_form" method ="POST" action ="" &gt; &lt;fieldset&gt; &lt;div class="control-group" style="margin-left:90px;"&gt; &lt;label class="control-label"&gt;Password&lt;/label&gt; &lt;div class="controls"&gt; &lt;input name="password" id="password" class="input-large" type="password" placeholder="Enter your Password" onfocus="Info_Over('#password_on_focus_info')" onblur="Info_Out('#password_on_focus_info')"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group" style="margin-left:90px;"&gt; &lt;label class="control-label"&gt;Confirm Password&lt;/label&gt; &lt;div class="controls"&gt; &lt;input name="repassword" id="repassword" class="input-large" type="password" placeholder="Re-enter your Password"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group" style="margin-left:250px;"&gt; &lt;button type="submit" id="password_send" class="btn btn-inverse submit"&gt;CONFIRM&lt;/button&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/td&gt; &lt;td width="400px" valign="top" style="padding-right:130px"&gt; &lt;span id="password_on_focus_info" style="display:none;"&gt; Password should be 8 characters or more. Choose a strong password which is a combination of Capital and Small case alphabets, Symbols and Numbers. &lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

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