获取元素的id并在sql查询中发布?

Hey, I am trying to get the id of an element and then post that id in a sql query like this:

jQuery gets id of checkbox:

$(document).ready(function() {    
    $(":checkbox").change(function(){
        var id = $(this).attr('id');

        $.post("index.php", { id: this.id, checked: this.checked },
            function(data){
              alert("Data Loaded: " + id);
            }
        );
       //return false to insure the page doesn't refresh
    });    
});

Then I insert that into the php query, but it doesn't display anything on the page. What am I missing?

    $query1 = "SELECT * FROM explore WHERE category IN ('".$_POST["id"]."') 
ORDER BY category LIMIT $start, $limit";

Corrected code:

$(document).ready(function() {    
    $(":checkbox").change(function(){
        var id = $(this).attr('id');

        $.post("index.php", { id: $(this).attr('id'), checked: $(this).attr('checked') },
            function(data){
              alert("Data Loaded: " + data);
            }
        );
       //return false to insure the page doesn't refresh
    });    
});

Also you point to checked property inside your function, but there is no such thing.

Ok using antyrat code:

$(document).ready(function() {     
    $(":checkbox").change(function(){ 
        var id = $(this).attr('id'); 

        $.post("index.php", { id: $(this).attr('id'), checked: $(this).attr('checked') }, 
            function(data){ 
              //alert("Data Loaded: " + data); 
$('#output').html(data);
            } 
        ); 
       //return false to insure the page doesn't refresh 
    });     
}); 

create a <div id="output"></div> within the body tag which is where the jquery will write the response too.