我有这个Jquery Javascript代码:
$(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' />");
}
});
});
});
这是我在include / adcontent.php中的PHP代码:
if (!isset($id) && isset($_GET['id'])){
$id=htmlspecialchars(strip_tags($_GET['id']));
}
echo $id;
但是使用此代码我有一条错误消息。脚本不发送GET数据。有什么问题?
答案 0 :(得分:0)
试试这个
$(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' />");
}
});
});
});
答案 1 :(得分:0)
你试过这个:
$.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);
}
});
你看到警报吗?