JavaScriptからサーバのPHPを実行したいのですが、上手くいきません。
JavaScripy
function Test(){ var xhr = new XMLHttpRequest(); xhr.open("POST","http://PORT/TEST.php",false); xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xhr.addEventListener("load", function(e){ console.log(xhr.responseText); }); xhr.send(null); }
TEST.php
<?php print('ss'); ?>
こうした場合、Javascript実行側にssではなくTEST.phpの内容すべてが表示されてしまいます。
回答1件
あなたの回答
tips
プレビュー