我一直在尝试找出为什么我的ajax调用和SQL查询无法正常工作的原因.当我查看脚本时,找不到任何错误,我的请求页面如下所示:
echo '<html><body>
<div class="first-row" bordercolor="yellow">
<div id="countdown"></div>
<script>
function UpdateRecord()
{
var userid = '.$userid.';
$.ajax({
type:"POST",url:"spotlightcount.PHP",data:{ userid: userid },success:function () {
alert("Ok!");
}
});
}
</script>
<script>
var timeleft = 10;
var downloadTimer = setInterval(function(){
document.getElementById("countdown").innerHTML = timeleft + " seconds remaining";
timeleft -= 1;
if(timeleft <= 0){
clearInterval(downloadTimer);
document.getElementById("countdown").innerHTML = "Finished";
UpdateRecord();
}
},1000);
</script>
</div>
<div class="second-row">
<iframe src="'.$row['adurl'].'"></iframe>
</div>
</body></html>';
include "config.PHP";
MysqL_connect($dbhost,$dbuser,$dbpass);
MysqL_select_db($dbname) or die("Error: Unable to select database");
session_start();
if (isset($_POST['userid'])){
$userid = $_POST['userid'];
@MysqL_query("Update ".$prefix."members set responsepoints=responsepoints+10,credits=credits+10 where Id=$userid limit 1") or die(MysqL_error());
}
exit;
?>
最佳答案