Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!
How to Configure the AJAX in JAVASCRIPT:
function GetHTTPObject() {
// This is for FireFox
if(window.XMLHttpRequest) {
try {
objHTTP = new XMLHttpRequest();
} catch(e) {
objHTTP = false;
}
// branch for IE/Windows ActiveX version
}
else if(window.ActiveXObject) {
try {
objHTTP = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch(e) {
try {
objHTTP = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch(e) {
objHTTP = false;
}
}
}
return objHTTP;
}
//or copy and paste it
function GetHTTPObject() {
// This is for FireFox
if(window.XMLHttpRequest) {
try {
objHTTP = new XMLHttpRequest();
} catch(e) {
objHTTP = false;
}
// branch for IE/Windows ActiveX version
}
else if(window.ActiveXObject) {
try {
objHTTP = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
objHTTP = false;
}
}
}
return objHTTP;
}
AND calling the function:
var url ='ajaxController.php?cityName=' +name +'&cpage=' +sPage;
var req = GetHTTPObject();
req.open('GET',url,false);
req.send(null);
if(req.readyState == 4 && req.status == 200) {
alert(req.responseText);
}