<script> function PostData() { // 1. Create XHR instance - Start var xhr; if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else if (window.ActiveXObject) { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } else { throw new Error("Ajax is not supported by this browser"); } // 2. Define what to do when XHR feed you the response from the server - Start xhr.onreadystatechange = function () { if (xhr.readyState < 4) { document.getElementById('sharebox').innerHTML = '<img src="skin/img/wait.gif" alt="WAIT" />'; } if (xhr.readyState === 4) { if (xhr.status == 200 && xhr.status < 300) { document.getElementById('sharebox').innerHTML = xhr.responseText; } } } var url = document.getElementById("url").value; // 3. Specify your action, location and Send to the server - Start xhr.open('POST', '../server/wall.php',true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("url=" + url); } </script>
tyle ze po wrzuceniu na serwer nie dziala, probowalem z pustym .htaccess to samo mieli i nic sie nie dzieje nawet timeout jest ciagle status wait. Wyczytalem gdzies ze serwer moze blokowac POST dla AJAX wiec ochoczo podmienilem wszystkie POST na GET i wtedy odpala sie na serwerze ale nic nie robil wczytuje w diva zdublowana strone.
Pomoze ktos? Moze cos nie doprecyzowalem?