codice:
function loadTEXTDoc(url) {
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
isIE = true;
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send();
}
}
}
function processReqChange() {
// only if req shows "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
// ...processing statements go here...
if(req.responseText) {
options = req.responseText // quà hai tutte le options della select
}
} else {
alert("There was a problem retrieving the Text data:\n" + req.statusText);
}
}
}
quando ti serve di popolare la select chiami la funzione loadTEXTDoc passandogli come parametro il file del server da eseguire.
in options hai tutte le coppie <option></option> che il tuo script lato server avrà restituito...
per come agganciarle alla alla select adesso non mi viene in mente...