function loadList(tb, id, comune_selezionato, tabindex) { var tab=tabindex; var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', 'http://www.case24.it/include/request.php?table='+tb+'&id='+id+'&comune_select='+comune_selezionato, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; if(resp) { var valore=resp; var output=""; // Aggiorno e visualizzo i campi $update("comuni", output); $visualizza("comuni"); $nascondi("comuni_vuoti"); } } else { alert(xmlHttp.responseText); } } } } //funzione per abilitare Ajax, la chiamata è diversa a seconda del browser function getXmlHttpObject() { var xmlHttp=null; try { //Firefox e Opera xmlHttp=new XMLHttpRequest(); } catch(e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } var myAjax = ajax(); function ajax() { var ajax = null; if (window.XMLHttpRequest) { try { ajax = new XMLHttpRequest(); } catch(e) {} } else if (window.ActiveXObject) { try { ajax = new ActiveXObject("Msxm12.XMLHTTP"); } catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } return ajax; } function request(str) { if(str.length>3) { myAjax.open("POST", "include/request_comuni.php"); myAjax.onreadystatechange = result; myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); myAjax.send("search="+str); } } function result() { if (myAjax.readyState == 4) { var liste = myAjax.responseText; var cible = document.getElementById('tag_update').innerHTML = liste; document.getElementById('tag_update').style.display = "block"; } } function selected(choice) { var cible = document.getElementById('s'); cible.value = choice; document.getElementById('tag_update').style.display = "none"; }