送信ボタンがあります。それをクリックすると、phpコールバックファイルから応答を返そうとしています。しかし、私は何の応答も得ていません。送信をクリックすると、次のURLを取得します
http://localhost/folder/new.php?submit=Submit+Query
PHPファイル名new.php
<script language="javascript" type="text/javascript">
function callme()
{
var req;
try
{
req = new XMLHttpRequest();
}catch (e)
{
try
{
req = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e)
{
try
{
req = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e)
{
alert("Your browser broke!");
return false;
}
}
}
req.onreadystatechange=function(){
if(req.readyState==4)
{
document.getElementById("display_area").innerHTML=req.responseText;;
}
}
req.open("GET","phpcall.php",true);
req.send();
}
</script>
および PHP コールバック file- という名前の phpcall.php
<?php
echo "returning from phpcall.php";
?>
ここでおそらく間違いは何ですか?? URLが変更された理由は何ですか
http://localhost/folder/new.php?submit=Submit+Query
フォーム部分に追加-
<form name='myForm'>
Max Age: <input type='text' id='age' /> <br />
Max WPM: <input type='text' id='wpm' />
<br />
Sex: <select id='sex'>
<option value="m">m</option>
<option value="f">f</option>
</select>
<input type='button' onclick='ajaxFunction()'
value='Query MySQL'/>
</form>
<div id='ajaxDiv'>Your result will display here</div>