function alterarTipologia(obj) { // document.getElementById('Submit_search').disabled = true; // document.getElementById('Submit_search').value = "A pesquisar..."; //Build the URL to connect to var url = "/commons/ajax_files/runtime/functions.ajax.php?function=dropdownTipologia&id_natureza=" + encodeURI( document.getElementById("id_natureza").value ) + "&id_tipologia=" + encodeURI( document.getElementById("id_tipologia").value ); // Open a connection to the server callServer(); xmlHttp.open("POST", url, true); // Setup a function for the server to run when it's done xmlHttp.onreadystatechange = listarTipologia; // Send the request xmlHttp.send(null); // document.getElementById('Submit_search').value = "Pesquisar"; // document.getElementById('Submit_search').disabled = false; } function listarTipologia() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { result = xmlHttp.responseText; document.getElementById('tipologia').innerHTML = decodeURI( result ); } else { alert('There was a problem with the request.'); } } } function countSearch() { //Build the URL to connect to if span exists //if (document.getElementById("searchTotal") !== null) { var url = "/commons/ajax_files/runtime/functions.ajax.php?function=countSearchProperties&id_natureza=" + encodeURI( document.getElementById("id_natureza").value ) + "&id_tipologia=" + encodeURI( document.getElementById("id_tipologia").value ) + "&id_negocio=" + encodeURI( document.getElementById("tipo_negocio").value ) + "&cod_distrito=" + encodeURI( document.getElementById("cod_distrito").value ) + "&cod_concelho=" + encodeURI( document.getElementById("cod_concelho").value ); // Open a connection to the server callServer(); xmlHttp.open("POST", url, true); // Setup a function for the server to run when it's done xmlHttp.onreadystatechange = listTotalProperties; // Send the request xmlHttp.send(null); //} } function listTotalProperties() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { result = xmlHttp.responseText; //alert(result); document.getElementById('searchTotal').innerHTML = decodeURI( result ); } else { alert('There was a problem with the request.'); } } }