GET请求无效

I am trying to record a link click through jquery to execute a php file but nothing is hapening.

$('#click').click(function(){
    $.get("record.php", { id: "a" }, function(data){});
});

Link

<a id='click' href='http://some link' target='_blank'>Start Download</a>

Record

<?php

include 'db.php';

if (isset($_GET['id']))
{
    mysql_query("INSERT INTO clicks VALUES ('','','','','')");
}

Running the php fron the file itself works good but from the jquery it doesnt

Any help please?

Try this:

$('#click').click(function(e){
    e.preventDefault();
    $.get("record.php", { id: "a" }, function(data){});
});

In your anchor tag you do not have to specify href

<a id='click' href='#'>Start Download</a>

$('#click').click(function(){
    $.get("record.php", { "id": "a" }, function(data){
       // Place here some logic (if you wish to do after getting your data from record.php

       window.location.href = 'your_url.php';
    });
});

If you want to pass your data as a json object and use a callback, try

$.get("test.cgi", { name: "John", time: "2pm" }).done(function(data) {
       alert("Data Loaded: " + data);
});

From : http://api.jquery.com/jQuery.get/

Try this :

Change your <a id='click' href='http://some link' target='_blank'>Start Download</a> to: <a id='click' href='javascript:void(0);'>Start Download</a>

Changed the href

In jQuery :

$('#click').click(function(){
    $.get("record.php", { id: "a" }, function(data){
        //some code here
    }).done(function() { window.location.href ='http://some link'; });
});