如果我点击外部链接,它就算了

How can I do the following thing:

When a user clicks on an external link e.g http://google.pl, jQuery detects the click and do some action.

I can do this using PHP, but then the link will be not external.

Could someone help me please?

if you want to process every link click:

$('a').click(function(e){
    ... do something ...
});

or you may filter links using something like:

$('a[href^="http://google.com/"]')

Thanks all!

$('a.externallink').click(function(e){
        $.ajax({  
              url: "/count.php?id="+id
             });
});

</div>