Guest User

Untitled

a guest
Apr 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <
  2.  
  3. <script type="text/javascript">
  4.  
  5. function ejecutarAJAX()
  6. {
  7. var ajaxRequest;
  8. if(window.XMLHttpRequest){ //navegadores tipo chrome
  9. ajaxRequest = new XMLHttpRequest();
  10. }else{ //navegadores antiguos (ie)
  11. ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
  12. }
  13.  
  14. //0 Petición no ha sido inicializada
  15. //1 Petición no ha sido establecida
  16. //2 Petición no ha sido enviada
  17. //3 Petición esta siendo procesada
  18. //4 Petición ha sido finalizada
  19.  
  20. var ajaxRequest = new XMLHttpRequest();
  21. ajaxRequest.onreadystatechange = function(){
  22. if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
  23. document.getElementById("info").innerHTML = ajaxRequest.responseText;
  24. }
  25. }
  26.  
  27. ajaxRequest.open("GET", "documento.txt", true);
  28. ajaxRequest.send();
  29.  
  30. }
  31. </script>
Add Comment
Please, Sign In to add comment