title: prevent a link from redirecting to another page
body: <p>I have a link in my page, and I want to prevent this link to redirect me to the link in the href attribute.</p>
  
  <p>I tried as the following:</p>
  
  <pre><code>$(function(){
      $('#logout-link').click(function(event){
          event.preventDefault();
  
          $.ajax({
              url     : $(this).attr('href'),
              success : function(data){
                  $('#login-loader').hide();
                          location.reload(true);
              },
              error   : function(){
                  $('#error-login').replaceWith('&lt;div id="error-login" class="msg fail"&gt;&lt;p&gt;Une erreur a été rencontrée lors du deconnexion!&lt;/p&gt;&lt;/div&gt;');
              }
          });
  
  
      });
  });
  </code></pre>
  
  <p>But it stills redirect me tho the other page.</p>
  
  <p>How can prevent a link from redirecting to another page ?</p>