function PopulateCities(el) { Net.get({url: "qry_city.php", vars: "State=" + el.value, onsuccess: function(R) { var respXML = R.responseXML; /** get xml from the xhr **/ var options = respXML.getElementsByTagName("city"); /** get the city nodes from the xml **/ var citySelect = document.getElementById("City"); /** select element **/ var optHTML; /** actual HTML output for the options **/ /** Remove all old elements BUT the default one (index 0) **/ var selectOpts = citySelect.getElementsByTagName("option"); for (var i=1; i