title: Jquery override link, work with url
body: <p>I have 3 links on a page. All have css class="suggested_product" and an id that is an integer I need to include in the url. I want to override what happens when you click. I have an ajax function that will send some data I am logging to a url, then once that's done redirect the page to the original url. Non-javascript fallback should always go to the original href.</p>
  
  <p>My problem is I haven't found how to get the original url or a#id from inside the click function. The link has an image and a span insde it, and the click event seems to be triggering on those instead of the a tag. I think.</p>
  
  <p>Code that doesn't work:</p>
  
  <pre><code>$(function(){
     $("a.suggested_product").click(function(e){
          e.preventDefault();
          original_url = e.target.href;
          log_url = "http://domain.com/ajax-controller/"+e.target.id;
          ajaxLogSuggestClick(log_url, original_url)
          return;
     });
  });
  </code></pre>
  
  <p>Suggestions?</p>