私は、コード値から変数を取得したい:私は、Webを実行したときに、私は別のファイルに(this.numMoves)を取得したいどのようにPHPからjavascriptに変数を取得するには?
/* Link Skor */
Memory.prototype.cekSkor = function(){
window.location = "./skor/index.php?value=" + this.numMoves;
}
Memory.prototype._winGame = function() {
var self = this;
if (this.options.onGameEnd() === false) {
this._clearGame();
this.gameMessages.innerHTML =
'<h2 class="mg__onend--heading">Keren!</h2>\
<p class="mg__onend--message">Kamu memenangkan game ini dalam ' + this.numMoves + ' gerakan.</p>\
<button id="mg__onend--restart" class="mg__button">Ingin Bermain Lagi?</button>\
<button id="mg__onend--skor" class="mg__button">Cek Skor?</button>';
this.game.appendChild(this.gameMessages);
document.getElementById("mg__onend--restart").addEventListener("click", function(e) {
self.resetGame();
});
document.getElementById("mg__onend--skor").addEventListener("click", function(e) {
self.skor();
});
} else {
// run callback
this.options.onGameEnd();
}
}
は
<?php
$skornya = $_GET['value'];
echo $skornya;
?>
はindex.phpです。私は読んでいない=エラー 値を取得
私はこの問題を解決するために行う必要がある何?
私はボタン /*リンクSkor */ Memory.prototype.cekSkor =機能(){ \t \t window.locationの=」./skor/indexでクリックする機能を持ってごめん間違った質問をemmm。 php?value = "+ this.numMoves; } –
これを使用すると、PHPでは$ _GET ["value"]を使用します。everthingはresolve =) –
ですが、単にindex.phpを表示することはできません。その –