<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function getXmlHttp(){
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();}
return xmlhttp;
}
function sendRequest()
{
var xhrObj=new getXmlHttp();
if(xhrObj)
{
xhrObj.open('GET','scripts/test.php',true);
xhrObj.onreadystatechange=function(){handleRespones(xhrObj);};
xhrObj.send(null);
}
else
{alert("Ошибка");}
}
function handleRespones(xhrObj)
{
if (xhrObj.readyState==4 && xhrObj.status==200)
{
var p=xhrObj.responesXML;
var msg=p.getElementsByTagName("message")[0].firstChild.nodeValue;
var responseOutput=document.getElementById("responseOutput");
responseOutput.innerHTML=msg;
}
else {alert("Ничего не вышло");}
}
window.onload=function()
{
document.getElementById("helloButton").onclick=sendRequest;
}
</script>
</head>
<body>
<form action="#">
<input type="button" value="say hello" id="helloButton" />
</form>
<div id="responseOutput">Тут будет вывод</div>
</body>
</html>
Подскажите пожалуйста , что не верно? Я уже и загуглил все и по книжкам смотрел, что-то ничего не выходит
