// (c) Xul.fr Licence Mozilla 1.1 var AjaxCaching = false; function display(content, storage) { storage.innerHTML = content; } function retrieve(url) { var storage = document.getElementById("storage"); var xhr = createXHR(); xhr.onreadystatechange=function() { if(xhr.readyState == 4) { if(xhr.status == 200) { var content = xhr.responseText; display(content, storage); } } }; if(AjaxCaching == false) url = url + "?nocache=" + Math.random(); xhr.open("GET", url , true); xhr.send(null); } function submitForm() { var xhr = createXHR(); var script = "ajax-cross-call.php"; // local script var data = document.ajax.data.value; // data to process remotely var filename = "ajax-cross-final.txt"; // file where to store data xhr.onreadystatechange=function() { if(xhr.readyState == 4) { retrieve(filename); } }; xhr.open("POST", script, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("data=" + data); }