title: jQuery function: send a form and stay in the current page
body: <p>I want to send a form and stay in the same internet page, to do that I'm using jQuery and ajax, my code is:</p>
  
  <pre><code>$(document).on('submit', '.commentSubmit', function() {
          var el = $(this);
          var message = el.children('textarea').val();
          if(message == '') {
              alert('you can\'t send an empty message');
              return false;
          } else {
              $.ajax({
                  url: el.attr('action'),
                  type: el.attr('method'),
                  data: el.serialize(),
                  success: function() {
                      alert('ok');
                  }
              });
              return false;
          }
  
  });
  </code></pre>
  
  <p>So it's working well but now I want to use a function so I'm doing:</p>
  
  <pre><code>sendMess = function(el){
          var message = el.children('textarea').val();
          if(message == '') {
              alert('you can\'t send an empty message');
              return false;
          } else {
              $.ajax({
                  url: el.attr('action'),
                  type: el.attr('method'),
                  data: el.serialize(),
                  success: function() {
                      alert('ok');
                  }
              });
              return false;
          }
  }
  
  
  $(document).on('submit', '.commentSubmit', function() {
      sendMess($(this));
  });
  </code></pre>
  
  <p>But now when I'm submiting my form I'm leaving the current page</p>