0
阿賈克斯需要幫助clearTImeout
<script type="text/javascript">
var stopTime =0;
var scoreCheck = function()
{
$.ajax({
url: 'http://127.0.0.1/ProgVsProg/main/checkScoreRoundOne',
success:function(output){
if(output !='Instruction'){
console.log(output);
clearTimeout(scoreCheck);
}
else
console.log(output);
stopTime = setTimeout(scoreCheck, 1000);
}
});
}
stopTime = setTimeout(scoreCheck,1000);
</script>
控制器
public function checkScoreRoundOne(){
$id = $this->session->userdata('userID');
$battleID = $this->lawmodel->getBattle($id);
foreach($battleID as $row){
$Rscore = $row->requestedScore;
$Cscore = $row->challengerScore;
if($Cscore == '1'){
$rID = $this->lawmodel->getID($row->challengerID);
foreach($rID as $row){
echo $row->username."Got the correct answer";
}
}
else if($Rscore == '1'){
$cID =$this->lawmodel->getID($row->requestedID);
foreach($cID as $row){
echo $row->username."Got the correct answer";
}
}
else
echo "Instruction";
}
}
進出口代碼混淆上述
- 在阿賈克斯,爲什麼當輸出!='指令'它會顯示「指令」,當輸出== '指令'它將顯示$ row-> username得到正確的答案。
- 當Cscore == 1或Rscore == 1時,如何停止setTimeout? 我想cleartimeout不會僅僅停留在setTimeout的..
PLSS幫助...進出口新的阿賈克斯..用笨
的setTimeout還是沒不停止.. – Zurreal