| Previous Article Galleriffic with ASP Classic and SQL Server 2005 Backened (or) Access Database | Populate triple drop down list from database using Ajax and Classic ASP | Next Article ASP Classic Lessons 1 - 4 | 
Coding Article #: 24 - Published On: September 09, 2011 @ 20:05:04 PM - Last Updated on: July 13, 2012
This article has been Favorited 44 timesJoin today, and add this to your favorites.
 
 
 
 
 
 

Share With Friends (Updated 6-8-2010)
Converted from PHP to Classic ASP
http://roshanbh.com.np/2008/01/populate-triple-drop-down-list-change-options-value-from-database-using-ajax-and-php.html
This is something that is needed in many projects for both PHP and ASP Classic.
This took about 30 minutes to convert over and is a must need for any AJAX and ASP Classic developer.
View Demo Page«
http://roshanbh.com.np/2008/01/populate-triple-drop-down-list-change-options-value-from-database-using-ajax-and-php.html
This is something that is needed in many projects for both PHP and ASP Classic.
This took about 30 minutes to convert over and is a must need for any AJAX and ASP Classic developer.
View Demo Page«
<script language="javascript" type="text/javascript">
// Roshan's Ajax dropdown code with php
// This notice must stay intact for legal use
// Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com
// If you have any problem contact me at http://roshanbh.com.np
function getXMLHTTP() { //fuction to return the xml http object
        var xmlhttp=false; 
        try{
            xmlhttp=new XMLHttpRequest();
        }
        catch(e)    {      
            try{           
                xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp=false;
                }
            }
        }
             
        return xmlhttp;
    }
     
    function getState(countryId) {     
         
        var strURL="findState.asp?country="+countryId;
        var req = getXMLHTTP();
         
        if (req) {
             
            req.onreadystatechange = function() {
                if (req.readyState == 4) {
                    // only if "OK"
                    if (req.status == 200) {                       
                        document.getElementById('statediv').innerHTML=req.responseText;                    
                    } else {
                        alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                    }
                }              
            }          
            req.open("GET", strURL, true);
            req.send(null);
        }      
    }
    function getCity(countryId,stateId) {      
        var strURL="findCity.asp?country="+countryId+"&state="+stateId;
        var req = getXMLHTTP();
         
        if (req) {
             
            req.onreadystatechange = function() {
                if (req.readyState == 4) {
                    // only if "OK"
                    if (req.status == 200) {                       
                        document.getElementById('citydiv').innerHTML=req.responseText;                     
                    } else {
                        alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                    }
                }              
            }          
            req.open("GET", strURL, true);
            req.send(null);
        }
                 
    }
</script>
Post to Facebook about: Populate triple drop down list from database using Ajax and Classic ASP




