title: Using new Image().src for click tracking
body: <p>I am attempting to figure out why this click tracker isn't working. The code was written by another developer so I am not entirely sure if this ever did work.</p>
  
  <pre><code>function trackSponsor(o, p) {
          (new Image()).src = PATH_BASE + 'click/' + p + '/' + o + "?_cache=" + (+(new Date()));
      return false;
  }
  </code></pre>
  
  <p>From what I can gather is that when this function is called it 'creates a new image' to fire a php script asynchronously. According to Firebug, the request is made however it is 'aborted' ~30ms in. The odd thing is that it will 'sometimes' work as in 1 in every 10+ regardless of the browser.</p>
  
  <p>I would much rather fix this so that it works instead of re-writing it as an ajax request. </p>
  
  <p>Any help is appreciated.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Because of tvanfosson's post that got me thinking. I have included the line which calls the click tracker below.</p>
  
  <pre><code>&lt;a onclick="trackSponsor(60, 15077); goToNextStep(1988, 15077, 0); return false;" href="#"&gt;view&lt;/a&gt;
  </code></pre>
  
  <p>the goToNextStep() actually changes the page. I am under the impression that it would only be executed after trackSponsor() had finished. </p>