How Ajax works with my php code?

Ajax amused me! With this technique my life makes it easier than before. I just read how this Ajax works until i finally created one that fits my needs, and i want to share it.

Here is what you need to have:
--------------------------------

function createRequestObject(){
var request_;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_ = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_ = new XMLHttpRequest();
}
return request_;
}

var http = createRequestObject();

function reload(page,param,refreshlocation) {
http.open('get', page+'?'+param);

http.onreadystatechange = function(){
if (http.readyState == 4)
{
var response = http.responseText;
document.getElementById(refreshlocation).innerHTML = response;
}else {
document.getElementById(refreshlocation).innerHTML = "
Loading...
";
}
}

http.send(null);

}

No comments:

Post a Comment