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<selectOpts.length; i++)
{
citySelect.removeChild(selectOpts[i]); /** remove option **/
}
/** Loop through all the cities **/
for (var i=0; i<options.length; i++)
{
var optVal = options[i].firstChild.data; /** get value of element **/
var opt = document.createElement("option"); /** create option **/
opt.value = optVal; /** set value of option **/
opt.innerHTML = optVal; /** set text of otpion **/
citySelect.appendChild(opt); /** add option to select **/
}
}});
}
function PopulatePositions(el)
{
Net.get({url: "qry_pos.php", vars: "City=" + el.value, onsuccess: function(R)
{
var respXML = R.responseXML; /** get xml from the xhr **/
var options = respXML.getElementsByTagName("pos"); /** get the position nodes from the xml **/
var posSelect = document.getElementById("Positions"); /** 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<selectOpts.length; i++)
{
posSelect.removeChild(selectOpts[i]); /** remove option **/
}
/** Loop through all the cities **/
for (var i=0; i<options.length; i++)
{
var optVal = options[i].firstChild.data; /** get value of element **/
var opt = document.createElement("option"); /** create option **/
opt.value = optVal; /** set value of option **/
opt.innerHTML = optVal; /** set text of otpion **/
posSelect.appendChild(opt); /** add option to select **/
}
}});
}