Helló! Itt egy tipp, ha több helyről is akarsz ugyanarra az ajax funkcióra hivatkozni(hq = http_request):
if (window.XMLHttpRequest) {
hq = new XMLHttpRequest();
if (hq.overrideMimeType) {
hq.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) {
try {
hq = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
hq = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
Funkcióvá alakítva tökéletesen működik
function myxml()
{
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
if (hq.overrideMimeType) {
hq.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) {
try {
return new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
return new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
}
És akkor így lehet meghívni:
hq = myxml();
hq.onreadystatechange = alertContents;
hq.open('POST', url, true);
stb stb...
(ezt akartam kérdezni, hogy hogy lehet de rájöttem, s gondoltam megosztom veletek:D)