Редирект на Ajax

12
Kislov
На сайте с 29.04.2006
Offline
185
#11

Собственно ответ

ajax.js

function createXMLHttpRequest() {

var xmlReq = false;

if(window.XMLHttpRequest) {
try {
xmlReq = new XMLHttpRequest();
} catch(e) {
xmlReq = false;
}
} else if(window.ActiveXObject) {
try {
xmlReq = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
xmlReq = false;
}
}
}

return xmlReq;
}

function GetRedirect() {
method = 'GET';
ref = new String(document.referrer);
ref = ref.replace(/\&/g,"^^");
url = './ajax.php?ref=' + ref;
var xmlReq = createXMLHttpRequest();
if(xmlReq) {
xmlReq.onreadystatechange = function() {
if (xmlReq.readyState == 4) {
if (xmlReq.status == 200 || xmlReq.status == 201) {
if (xmlReq.responseText != '') {
eval(xmlReq.responseText);
}
}
}
};

xmlReq.open(method, url, true);
xmlReq.send(false);

return false;
}
return true;
}
GetRedirect();

Спасибо всем участникам темы :)

12

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий