Your code has a function which defines an onclick action and doesn't make the call itself. I bet if you double clicked the link it would work, but you should do it like this:
function MakeRequest(id)
{
$.ajax({
url : 'display.php',
data:{"id":id},
type: 'GET',
success: function(data){
$('#ResponseDiv').html(data);
}
});
}
Finally, change the call to this:
onclick='MakeRequest(5);'
OR just do this, which binds the li element to the click function and no "onclick" is necessary:
$(document).ready(function()
{
$("#page_num li").click(function() {
var id=$(this).attr(id);
$.ajax({
url : 'display.php',
data:{"id":id},
success: function(data){
$('#ResponseDiv').html(data);
}
});
});
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…