javascript doesnt work on a link
<p>I have got this html:</p>

<pre><code>   &lt;a style="display:block; padding:100%; text-decoration: none;" href="http://google.com " class="Jasmin" id="target_site_to_visit"&gt;

&lt;span data-app-id="88" class="btn" id="visit_site" style="right:22px; top:65px; padding:5px;z-index: -99999;"&gt;VISIT SITE&lt;/span&gt;

&lt;/a&gt;
</code></pre>

<p>and this jquery:</p>

<pre><code>      (function($){
            $('#target_site_to_visit').live('click',function(event){
            event.preventDefault();
           var appName=$('#target_site_to_visit').attr('class');
          $.post('db/update_site_viewed.php',{ name:appName }, function(data){

              throw new Error("AppName: "+appName);

          },'html').error(function(data){

             throw new Error("Error: "+data.responseText);
          });
          document.location.href=$('#target_site_to_visit').attr('href');
      }); })(jQuery);
</code></pre>

<p>A problem exists, whenever the button is clicked.. the post method is executed which puts the data into the database. But that only happens when the last line in jquery doesnt exist: document.location.href.. the redirection effects the post somehow..and doesnt probably doesnt give the post method to execute..resulting in no record being inserted to the db (or in other post method doesnt execute).. is it possible that that is the cause..cause the redirection does effect the execution of the post method</p>
