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-get.php"; var filename = "ajax-cross-get.txt"; 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(null); }