Código HTML:
function nuevoAjax() { var xmlhttp=false; try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");} catch(e){ try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");} catch(E){ if (!xmlhttp && typeof XMLHttpRequest!='undefined') xmlhttp=new XMLHttpRequest(); } } return xmlhttp; } function enviarDatos(){ var var1 = $F('txt1'); var var2 = $F('txt2'); var var3 = $F('txt3'); var var4 = $F('txt4'); var var5 = $F('txt5'); var url = "sql.php"; var urlparametros = "variable1="+var1+"&variable2="+var2+"&variable3="+var3+"&variable4="+var4+"&variable5="+var5; alert(urlparametros); var ajax = nuevoAjax(); ajax.open("POST",url,true); ajax.onreadystatechange=function(){ if(ajax.readyState==1){ $('agregar').hide(); $('espera').show(); } if(ajax.readyState==4){ $('espera')=ajax.responseText; } ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded"); ajax.send(urlparametros); } }