チェックボックスをオンにすると、Ajax を使用して別の php スクリプトが呼び出されます。現在、php スクリプトにはボタン付きの 3 つのテキスト ボックスがあり、ボタンが押されるたびに、別の php スクリプトを呼び出すために Ajax が実行されます。そのすべてが同じページで実行されます!、それはちょうどこのようなものです
PHP -> Ajax -> PHP -> Ajax -> PHP
それは可能ですか、それとも処理するには多すぎますか?!
私の最初のAjaxは次のとおりです。
<script type = 'text/javascript'>
function load(cb, pos)
{
if (cb.checked == false)
{
document.getElementById(pos).innerHTML="";
return;
}
if (window.XMLHttpRequest)
xmlhttp = new XMLHttpRequest();
else
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
document.getElementById(pos).innerHTML = xmlhttp.responseText;
}
xmlhttp.open('GET', "trying.inc.php?pass='true'", true);
xmlhttp.send();
}
</script>
「Tring.inc.php」にある 2 番目の Ajax:
<script type = 'text/javascript'>
function check()
{
if (window.XMLHttpRequest)
xmlhttp = new XMLHttpRequest();
else
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
document.getElementById('adiv').innerHTML = xmlhttp.responseText;
}
Parameters = "OldPass="+document.getElementById('OldPass').value+"&newPass="+document.getElementById('newPass').value+"&Confirm="+document.getElementById('ConfirmPass').value;
xmlhttp.open('POST', 'Trying2.inc.php', true);
xmlhttp.setRequestHeader ('Content-type', 'application/x-www-form-urlencoded');
xmlhttp.send(Parameters);
}
</script>
「Trying2.inc.php」を呼び出します。
「trying.inc.php」ページにいるとき、Ajax は「trying2.inc.php」を呼び出して動作しますが、メイン ページから「trying.inc.php」を呼び出すことができますが、「trying.inc.php」 「trying2.inc.php」を呼び出すことができません。これ以上説明する方法がわからないため、明確であることを願っています。それを達成するために何ができるかが可能であれば、コードでサポートしてください。私は学習目的でこれを行っています。私を厳しくしないでください。よろしくお願いします。