Беру простейший код и пытаюсь вывести итог через PHP. И не работает.
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;
}
var params = encodeURIComponent(name)
xmlhttp.open("POST", '/script.html', true);
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(params);
alert(params);
<? echo $_POST['params']; ?>
Как же так?
Даже alert не работает!
Ругается почему-то на "xmlhttp is not defined". Хотя он явно определен в функции выше!