A
Alex
Example uploaded to:
http://www.clickatus.com/ajax/
BTW - This is for FIREFOX, won't work in IE.
I don't know why but when it is executed the browser still in loading
state... Even though XMLHttpRequest already got its string from the
server...
Any help?
PHP server script outputs "Hello"
<html><head><meta http-equiv="Content-Type" content="text/html;
charset=windows-1252"><title>Ajax Test</title>
<script language="javascript" type="text/javascript">
//Run my function "f_StartEngine" on page load
window.onload=f_StartEngine;
//Starts up engine
function f_StartEngine(){
//netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
var ajax = new XMLHttpRequest();
ajax.open('POST', "ajax_test.php", true);
ajax.onreadystatechange = function () {
if (ajax.readyState == 4) {
if (ajax.status == 200) document.write(eval(
'('+ajax.responseText+')' ));
else alert("An error occurred: " + ajax.statusText);
}
};
ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.send(null);
}
</script></head><body></body></html>
http://www.clickatus.com/ajax/
BTW - This is for FIREFOX, won't work in IE.
I don't know why but when it is executed the browser still in loading
state... Even though XMLHttpRequest already got its string from the
server...
Any help?
PHP server script outputs "Hello"
<html><head><meta http-equiv="Content-Type" content="text/html;
charset=windows-1252"><title>Ajax Test</title>
<script language="javascript" type="text/javascript">
//Run my function "f_StartEngine" on page load
window.onload=f_StartEngine;
//Starts up engine
function f_StartEngine(){
//netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
var ajax = new XMLHttpRequest();
ajax.open('POST', "ajax_test.php", true);
ajax.onreadystatechange = function () {
if (ajax.readyState == 4) {
if (ajax.status == 200) document.write(eval(
'('+ajax.responseText+')' ));
else alert("An error occurred: " + ajax.statusText);
}
};
ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.send(null);
}
</script></head><body></body></html>