Ajax CAll
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#maincontent1').load('<?php echo "http://127.0.0.1/ProgVsProg/main/checkScore"?>').fadeIn("slow");
},5000); // refresh every 10000 milliseconds
</script>
控制器
public function checkScore(){
$id = $this->session->userdata('userID');
$battleID = $this->lawmodel->getBattle($id);
foreach($battleID as $row){
$Rscore = $row->requestedScore;
$Cscore = $row->challengerScore;
if($Cscore=="80"){
$cID = $this->lawmodel->getID($row->challengerID);
foreach($cID as $row){
//redirect('main/secondRound');
echo $row->username." got the correct answer";
//echo "<script>javascript:alert('".$row->username."')</script>";
}
}
else if($Rscore == '80' or $Rscore=='2' or $Rscore=='3'){
$rID =$this->lawmodel->getID($row->requestedID);
foreach($rID as $row){
echo $row->username." got the correct answer";
}
}
}
}
我在这个ajax调用中遇到了问题..
我对ajax调用的目的是它总是会检查数据库是否有更新...当有更新时..会显示更新。
我意识到,因为我把这个ajax调用..有一段时间它会突然退出我的会话。我无法找到导致此错误的原因。
PLss help..im ajax anew中的新手