Fetching a url from XML
===

I am trying to fetch a url which is in tag in a xml file. I have to use this url in further part of the program. Can any body help ?

This code appear in a coldfusion file where I have to use the coldfusion variable on which I trying to set the url in FB sharing.

    <script>
    	
    window.onload=function(){
    
    	var r_data = ranger_descp(#rang_id#);
    	<cfset rang_URL = r_data>
    }
    	
    function loadXMLDoc()
    { 
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
          var xmlhttp=new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
          xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open("GET","../rangers/js/rangers.xml",false);
        xmlhttp.send();
        xmlDoc=xmlhttp.responseXML; 
        return xmlDoc;
    }
        
    var xmlDoc=loadXMLDoc("../rangers/js/rangers.xml");
    var object = xmlDoc.getElementsByTagName("site");
    var url=new Array();
    var id=new Array();
        
    function ranger_descp(rang_id){
            //alert(xmlDoc);
            for(i=0; i< object.length; i++)
            {
    			id[i]=object[i].getElementsByTagName("id")[0].childNodes[0].nodeValue;		
    			if(id[i] == rang_id)
    			{		   
    		   		url[i]=object[i].getElementsByTagName("url")[0].childNodes[0].nodeValue;
    		   		var r_url=url[i];
    		   		return [r_url];		   
    			}            
         }
    } 

If anything is missing in it then please suggest :)