在Ajax中获取数据不起作用

I have this Jquery Javascript code:

$(document).ready(function(){
    $("#check_button").click(function(){
        $.ajax({
            url: "includes/adcontent.php",
            type: "GET",
            data: "id=<?php echo $id; ?>",
            async: false,
            cache: false,
            beforeSend: function (data) {
                    $('#check_quest_button_div').html("<img src='/images/icons/loading.gif' title='Please wait' alt='Please wait' />");
            }
        });
    });
});

And this is my PHP code in includes/adcontent.php:

if (!isset($id) && isset($_GET['id'])){
    $id=htmlspecialchars(strip_tags($_GET['id']));
}
echo $id;

But with this code I have an error message. The script doesnt send the GET data. What is the problem?

Try this

$(document).ready(function(){
    $("#check_button").click(function(){
        $.ajax({
            url: "includes/adcontent.php?id=<?php echo $id; ?>",
            type: "GET",
            async: false,
            cache: false,
            beforeSend: function (data) {
                    $('#check_quest_button_div').html("<img src='/images/icons/loading.gif' title='Please wait' alt='Please wait' />");
            }
        });
    });
});

Have you tried this:

$.ajax({
    url: "includes/adcontent.php?id=<?php echo $id; ?>",
    type: "GET",
    async: false,
    cache: false,
    beforeSend: function (data) {
        $('#check_quest_button_div').html("<img src='/images/icons/loading.gif' title='Please wait' alt='Please wait' />");
    },
    success: function (data) {
        alert(data);
    }
});

Do you see the alert?