See this main file:
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
function GetXmlHttpObject(){
var objXMLHttp = null
if (window.XMLHttpRequest){
objXMLHttp=new XMLHttpRequest();
}
else if (window.ActiveXObject){
objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
return objXMLHttp;
}
function LoadHM(url){
xmlHttp = GetXmlHttpObject()
if (xmlHttp == null){
alert ("Browser does not support HTTP Request")
return
}
xmlHttp.onreadystatechange = AfterHMLoaded
xmlHttp.open("GET", url, true)
xmlHttp.send(null)
}
function AfterHMLoaded(){
if(xmlHttp.readyState == 1){
document.getElementById("LoadCity").disabled = true;
document.getElementById("loading").style.visibility = "visible";
}
if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){
document.getElementById("loading").style.visibility = "hidden";
document.getElementById("LoadCity").disabled = false;
document.getElementById("LoadCity").innerHTML = xmlHttp.responseText
}
}
function LoadFile(values){
LoadHM(values + "&action=" + Math.random());
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<p>
<select name="cmbStates" onchange="LoadFile('ladingfile.php?stateid='+this.value);">
</select>
</p>
<div id="LoadCity">
<div id="loading"><img src="../images/ajxloading.gif" /></div>
</form>
</body>
</html>
And the loadingfile.php
Code:
<?php
//select cities getting the value of state
$stateid = $_GET['stateid'];
?>
<select name="cmbCities">
</select>
Do you understand something from this aforesaid codes?
Bookmarks