title: AJAX submit both ENTER and CLICK
body: <p>So I have a form to submit user login data. But currently the default of data submitting is by clicking a button. This script can work both click the button or pressing ENTER on Mozilla, but not in Chrome. How to resolve my problem? </p>
  
  <p>JAVASCRIPT:</p>
  
  <pre><code>$(document).ready(function(){
              $('#buttonSignIn').click(function(s){
  
                  s.preventDefault();
  
                  var error     = false;
                  var _wait_    = $(this).attr('data-wait');
                  var user      = $('#user').val();
                  var pass      = $('#password_signin').val();
                  var waitHtml  = $(this).html();
                  var _wait     = '...';
                  var _waitHtml = waitHtml + _wait;
  
                  if( user == '' || user == 0 || trim( user ).length  == 0 ) {
                      var error = true;
                      $('#user').focus();
                  }
  
                  if( error == false ){
                      $('#buttonSignIn').attr({'disabled' : 'true'}).html(_waitHtml).css({'opacity':'0.5'});
  
                      $.post("asset/ajax/sign_in.php", $("#signin_form").serialize(),function(result){
  
                          if( result == 'True' ){
                               $('#signin_form input, .forgot, #buttonSignIn, #recover_pass_form').remove();
                               $('#success_signin').fadeIn(500).html(_wait_);
                               $('#error').fadeOut(500);
                               $("#signin_form").reset();
  
                              $('body,html').animate({
                                  scrollTop: 0
                              }, 500);
  
                               setTimeout(function()
                               {
                                  window.location.reload();
  
                                },500 );
                          }
                          else{
                               $('#error').fadeIn(500);
                               $('#error').html( result );
                               $("#signin_form").reset();
                               $('#buttonSignIn').removeAttr('disabled').html(waitHtml).css({'opacity': 1});
                          }//&lt;-- ELSE
                      });//&lt;-- END $POST AJAX
                  }//&lt;-- END ERROR == FALSE
              });//&lt;-- END FUNCTION CLICK
  }
  
                          &lt;form action="" method="post" name="form" id="signin_form" class="form_login signInForm"&gt;
                              &lt;input type="text" name="user" id="user" placeholder="&lt;?php echo $_SESSION['LANG']['placeholder_email_username']; ?&gt;" title="&lt;?php echo $_SESSION['LANG']['placeholder_email_username']; ?&gt;" /&gt;
                              &lt;input type="password" name="password" id="password_signin" placeholder="&lt;?php echo $_SESSION['LANG']['placeholder_pass']; ?&gt;" title="&lt;?php echo $_SESSION['LANG']['placeholder_pass']; ?&gt;" /&gt;
                              &lt;span id="error"&gt;&lt;/span&gt;
                              &lt;span id="success_signin"&gt;&lt;/span&gt;
                              &lt;a style="cursor: pointer;" class="recover_pass buttonInside forgot buttonForgot"&gt;&lt;?php echo $_SESSION['LANG']['placeholder_forgot_pass']; ?&gt;&lt;/a&gt;
                              &lt;button type="submit" id="buttonSignIn" class="button_class" data-wait="&lt;?php echo $_SESSION['LANG']['please_wait']; ?&gt;"&gt;&lt;span&gt;&lt;?php echo $_SESSION['LANG']['sign_in']; ?&gt;&lt;/span&gt;&lt;/button&gt;
                          &lt;div class="clear"&gt;&lt;/div&gt;
                          &lt;/form&gt;
  </code></pre>