Całość aplikacji mam zrobionej na zasadzie komunikacji z zewnętrznym plikiem php używam do wyciągania następujących funkcji:
<?php var http = getXMLHTTPRequest(); function getServerText(variable) { var myurl = 'php.php'; myRand = parseInt(Math.random()*99999999999999); var modurl= myurl+"?rand="+myRand+"&opcja="+variable; http.open("GET", modurl, true); http.onreadystatechange = useHttpResponse; http.send(null); } function useHttpResponse() { if(http.readyState == 1) { document.getElementById('myPageElement').innerHTML = "Loading"; } else if(http.readyState == 4) { if(http.status == 200) { var mytext = http.responseText; document.getElementById('myPageElement').innerHTML = mytext; } } else { document.getElementById('myPageElement').innerHTML=""; } } ?>
i potrzebuje przesłać do pliku php.php dane z pól <input> obojętnie jaką metodą a potem po wywołaniu odpowiedniej zmiennej GET lub POST można było spowrotem przeładować do strony.