AJAXリクエストを処理するJavaScriptファイルがあります。このリクエストはPHPファイルを処理します(これは正常に機能します)。$_SESSION
しかし、このPHPファイルで自分の変数(または他のPHPファイルのクラスに実装されている静的変数)を呼び出したい場合、それは認識されません(私はecho
それを持っています500 error
)。
JSファイルには、次のものがあります。
$.ajax({
type: "POST",
url: "../classes/ajax/myfile.php",
data: "comment="+encodeURIComponent(text),
success: function(msg){
/* PHP returns the automatically assigned ID of the new comment */
}
});
PHPファイルでは、次のように変数をテストします。
require_once '../Account.php';
$temp=Account::getCurrentAccount()->getId();
echo($temp);
exit;
誰かがアイデアを持っていますか?