Javascript JQuery/Ajax到php的帖子会破坏JQuery/Js代码吗?
知道发生了什么吗? 在我删除post代码之后,代码又开始完美地工作了 如何突破:很明显,代码还有很多,这是一个游戏,简单地说,游戏不是开始的,它只是“突破” 代码编辑 它仍然没有发布到file.txt文件。感谢baao指出错误Javascript JQuery/Ajax到php的帖子会破坏JQuery/Js代码吗?,javascript,php,jquery,post,Javascript,Php,Jquery,Post,知道发生了什么吗? 在我删除post代码之后,代码又开始完美地工作了 如何突破:很明显,代码还有很多,这是一个游戏,简单地说,游戏不是开始的,它只是“突破” 代码编辑 它仍然没有发布到file.txt文件。感谢baao指出错误 <?php $hiScore = $_POST['hiScore']; $userip = $_POST['userip']; $file = fopen('file.txt','w+'); fwrite($file, $hiScore.'\t'.$userip)
<?php
$hiScore = $_POST['hiScore'];
$userip = $_POST['userip'];
$file = fopen('file.txt','w+');
fwrite($file, $hiScore.'\t'.$userip);
fclose($file);
?>
if(-1
解释一下它是如何断裂的。似乎我忘记了另一个答案中的括号。我已经为您更正了…:)<代码>
<?php
$hiScore = $_POST['hiScore'];
$userip = $_POST['userip'];
$file = fopen('file.txt','w+');
fwrite($file, $hiScore.'\t'.$userip);
fclose($file);
?>
function PostTo() {
$.ajax({
url:'src/Score.php',
type:'post',
data:{hiScore:hiScore,
userip:userip},
success:function(data){
alert(data);
} // <<<<<<<<<<<<<<<<you have forgotten the closing bracket here
});
}
<?php // <<<<< here
$hiScore = $_POST['hiScore'] ? $_POST['hiScore'] : 'not set';
$userip = $_POST['userip'] ? $_POST['userip'] : 'not set';
$file = fopen('file11111111.txt','a+');
fwrite($file, 'Score: '.$hiScore.' IP is: '.$userip.' '.PHP_EOL);
fclose($file);
echo "I was here!";
?> // <<<<<< and here
if (-1 < score && score < 6) { doStuff(); } // |
if (5 < score && score < 9) { doStuff2(); } // |
if (8 < score && score < 15) { doStuff3(); } // |
if (14 < score && score < 21) { doStuff4(); } // |
if (20 < score && score < 27) { doStuff5(); } // |||||| should all be hiScore?!?
if (26 < score && score < 31) { doStuff6(); } // |
if (30 < score && score < 36) { doStuff7(); } // |
if (35 < score && score < 51) { doStuff8(); } // |
if (50 < score && score < 69) { doStuff9(); } // |