Ver Mensaje Individual
  #4 (permalink)  
Antiguo 16/01/2011, 20:37
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: envio de datos (6 datos )xmlhttp.open("GET","views/getuser.php?q="+str,tr

segui el consejo de ustedes y lei

http://www.w3schools.com/ajax/tryit....e=tryajax_post

pero al ponerlo a correr no me funciona

<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp .responseText;
}
}
xmlhttp.open("POST","demo_post.php",true);
xmlhttp.send();
}
</script>
</head>
<body>

<h2>AJAX</h2>
<form action="" method="POST">
<input name="a" type="text" id="a">
<input name="b" type="text" id="b">
<div id="myDiv"></div>
<button type="button" onclick="loadXMLDoc()">Request data</button>
<p>Click the button several times to see if the time changes, or if the file is cached.</p>
</form>
</body>
</html>


al otro lado tengo

<?
$a=$_POST["a"];
$b=$_POST["b"];
$suma= $a+$b;
echo $suma;


?>


gracias por la atencion prestada