﻿// JScript File

function ajaxFunction(paravalue,ComboName)
  { 

 var xmlHttp;
    try{
            // Firefox, Opera 8.0+, Safari
            xmlHttp=new XMLHttpRequest();
        }
    catch(e)
    {
      // Internet Explorer
      try
      {  
          xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
      }
      catch (e)
      {     
                try
                {       
                     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e)
                {        
        
                    alert("Your browser does not support AJAX!"); 
            
                   return false;
                }
       }
    
    }
   
  
  //xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");       
     xmlHttp.open("GET","FillDropDown.aspx?"+paravalue,true);
      xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4 && xmlHttp.responseText)
        {
            var str=xmlHttp.responseText;
            //alert(str);
            document.getElementById(ComboName).options[document.getElementById(ComboName).options.length] = new Option('Select City','Select City');
            var myarray=str.split(',');

            for(var i=0;i<myarray.length;i=i+1)
                {
                    document.getElementById(ComboName).options[document.getElementById(ComboName).options.length] = new Option(myarray[i], myarray[i]);

                }
        }
      }
                
                xmlHttp.send(null);
      }
      
      
    function clearCombo(ComboName)
    {
        for (var i =  document.getElementById(ComboName).options.length - 1; i >= 0; i--)
        {
            document.getElementById(ComboName).options[i] = null;
        }
             document.getElementById(ComboName).selectedIndex = -1;
    }