Bu benim kod:
comenzar = function(){
document.getElementById('gene').onclick = xmlhttpPost("generador.php");
}
xmlhttpPost = function(strURL){
xmlHttpReq = false;
self = this;
self.xmlHttpReq = new XMLHttpRequest();
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function(){
if(self.xmlHttpReq.readyState == 4){
update(self.xmlHttpReq.responseText);
}
}
self.xmlHttpReq.send(getquerystring());
}
getquerystring = function(){
form = document.getElementById('formu');
combi = document.getElementById('sele').options[document.getElementById('sele').selectedIndex].value;
qstr = "tres=" + escape(combi);
return qstr;
}
update = function(resu){
document.getElementById('tag').innerHTML = resu;
}
window.onload = comenzar;
</script>
</head>
<body>
<form id=formu>
<select id=sele>
<option>C</option>
<option>v</option>
</select>
<button id=gene><p>generate</p></button>
</form>
<p id=tag></p>
</body>
</html>
//generador.php
<?php
echo( "tu combinacion" . $_POST['tres'] );
?>