title: jQuery does not block the form from submission when user clicks on "Enter" on the keyboard
body: <p>I don't want to have my form get submitted regularly. I want it to be ajax.</p>
  
  <p>I have written a code to prevent the form submission either when user clicks the button or presses the "Enter", and submit it via ajax.</p>
  
  <p>It works for the button, but when the user hits Enter on the keyboard the form submits and redirects.</p>
  
  <p>Here is what I have written:</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  $(document).ready(function(){
      $(document).on('keypress', function(event){
  if( event.which == 13)
  {
                  var container = $('#pricetable'),
          loader = $("&lt;div&gt;",{
              "class" : "ajax-loader"
              }),                                           
          container.html(loader).show();
                  $("#seenform").ajaxSubmit({
                  url : "../controllers/ctr.orders.php",
                  success: function( responseText, statusText, xhr )
                   {
                       loader.remove();
                       var data = responseText;
                       container.html( data );
                   }
  });
  console.log(responseText);
  return false;
  } // end of event.which if
       });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Not that, when I use following code it does not gets redirected, however I need it to send the ajax as well:</p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  $(document).ready(function(){
      $(document).on('keypress', function(event){
  if( event.which == 13)
  {
  
  console.log(responseText);
  return false;
  } // end of event.which if
       });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>The two code blocks only differ in their ajax part. in the second code block I still have not added the ajax-sending part.</p>