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>
Controller
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";
}
}
}
}
I have a problem in this ajax call..
my purpose on that ajax call is it will always check if there is an update on the database..and when there is an update..it will display the update.
and i realize since i put this ajax call..there is a time it will suddenly logout my session. I cant find what is cause of this error.
PLss help..im a newbie in ajax