You can get PHP tutorials, ajax codings, free html,javascript tips & tricks, making webpages faster with minimizing mysql query, create your site through xml, helpful tips & tricks for creating websites, control the site through xml, get ajax codings using get & post method in ajax method, convert videos to any format using FFMPEG PHP, create multilanguage website, create content in chinese, send mail in chinese language, Iframe virus removal, free sms using php webservice,
Thursday, June 19, 2008
Simple Ajax Coding
var xmlHttp // xmlHttp variable
function GetXmlHttpObject() { var objXMLHttp = null;
if( window.XMLHttpRequest ) {
try {
objXMLHttp = new XMLHttpRequest();
}
catch( e ) {
objXMLHttp = false; }
}
else if( window.createRequest ) {
try {
objXMLHttp = new window.createRequest();
}
catch( e ) {
objXMLHttp = false;
}
}
else if( window.ActiveXObject ) {
try {
objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch( e ) {
try {
objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch( e ) {
objXMLHttp = false;
}
}
}
return objXMLHttp;
}
function search_subcategory(){
//alert('sdfsdf');
document.getElementById('subcategory_label').style.display="none";
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
alert ("Browser does not support HTTP Request")
return
}
var val = document.getElementById('category').value;
var url="dropdown.php?val="+val;//alert(url);
xmlHttp.onreadystatechange = response;xmlHttp.open("GET",url,true);
xmlHttp.send(null);
function response(){
if (xmlHttp.readyState == 4) {
var x =xmlHttp.responseText;
document.getElementById('subcategory_label').style.display="block"; document.getElementById('subcategory_label').innerHTML = x; }
else {
document.getElementById(y).style.display = "block";
document.getElementById(y).innerHTML ="Loading...";
}
}
}
Subscribe to:
Posts (Atom)