title: jQuery - stop form submission from changing page using ajax
body: <p>I am trying to submit a form without reloading the page. I have tried using this script with no success:</p>
  
  <pre><code>$('#formId').submit(function(e){
      $.ajax({
          type: "POST",
          url: 'serverSide.php',
          data: $('#formId').serialize(),
          success: function(data){
              alert(data);
          }
      });
      e.preventDefault();
  });
  </code></pre>
  
  <p>Does anyone know what I am doing wrong?</p>