title: Use AJAX and THEN follow a link
body: <p>I am having an issue with processing an AJAX function in jQuery and then following a link.  I have a function that runs on ANY click on a page like <code>jQuery('body').live('click', function(event) {});</code></p>
  
  <p>This event may or not be a link.   Within this callback I have something like <code>jQuery.post();</code> running.  So anytime a click event happens anywhere on the body this runs.  My issue occurs when this click is a link or some sort of div inside a link.  I have tried things like:</p>
  
  <p><code>event.preventDefault();</code></p>
  
  <p>followed by </p>
  
  <p><code>if ( jQuery(event.target).attr('href').length ) {
              var url = jQuery(event.target).attr('href');
              window.setTimeout(function(){document.location.href=url;}, 1000); // timeout and waiting until effect is complete
          }</code></p>
  
  <p>but the problem with this is that if you have something like <code>&lt;a&gt;&lt;div&gt;&lt;/div&gt;&lt;/a&gt;</code> this will not work.  My question is....</p>
  
  <p>Is there a reliable way to pause a link being followed, process AJAX, and then resume following the link?</p>