Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/01/2012, 02:19
Avatar de jor_0203
jor_0203
 
Fecha de Ingreso: octubre-2011
Ubicación: mexico
Mensajes: 760
Antigüedad: 12 años, 7 meses
Puntos: 8
cual es la diferencia entre el método pos y el método get en ajax

cual es la diferencia entre el método pos y el método get en ajax

que es lo que debo agregar y que debo quitar para usar métodos


Código PHP:
Ver original
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. var xmlhttp;
  5. function loadXMLDoc(url,cfunc)
  6. {
  7. if (window.XMLHttpRequest)
  8.   {// code for IE7+, Firefox, Chrome, Opera, Safari
  9.   xmlhttp=new XMLHttpRequest();
  10.   }
  11. else
  12.   {// code for IE6, IE5
  13.   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  14.   }
  15. xmlhttp.onreadystatechange=cfunc;
  16. xmlhttp.open("GET",url,true);
  17. xmlhttp.send();
  18. }
  19. function myFunction()
  20. {
  21. loadXMLDoc("ajax_info.txt",function()
  22.   {
  23.   if (xmlhttp.readyState==4 && xmlhttp.status==200)
  24.     {
  25.     document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
  26.     }
  27.   });
  28. }
  29. </script>
  30. </head>
  31. <body>
  32.  
  33. <div id="myDiv"><h2>Let AJAX change this text</h2></div>
  34. <button type="button" onclick="myFunction()">Change Content</button>
  35.  
  36. </body>
  37. </html>