Ver Mensaje Individual
  #5 (permalink)  
Antiguo 22/04/2015, 06:51
davidddp
 
Fecha de Ingreso: julio-2011
Ubicación: Santa Amalia
Mensajes: 22
Antigüedad: 12 años, 9 meses
Puntos: 1
Respuesta: Abrir nueva página dentro de la actual

Llevo un buen rato para intentar la solución con AJAX pero no lo consigo, supuestamente está bien el ejemplo pero pone más abajo que hay que añadir tambien "http = createRequestObject ()", lo he añadido a la función "function sendReq(req) " pero sigue sin funcionar.
Si alguien consiguiera hacer funcionar el método de AJAX estaría muy agradecido.

Estoy probando así, si alguien tiene alguna sugerencia...

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2.     <title>Prueba Ajax</title>
  3. </head>
  4.         <p>hola</p>
  5.  
  6.         <script type="text/javascript">
  7.  
  8.         function createRequestObject()
  9.         {
  10.             var obj;
  11.             var browser = navigator.appName;
  12.             if (browser == "Microsoft Internet Explorer") {
  13.                 obj = new ActiveXObject("Microsoft.XMLHTTP");
  14.             } else {
  15.                 obj = new XMLHttpRequest();
  16.             }
  17.             return obj;
  18.         }
  19.  
  20.         function sendReq(req)
  21.         {    
  22.             http = createRequestObject();
  23.             http.open('get', req);
  24.             http.onreadystatechange = handleResponse;
  25.             http.send(null);
  26.         }
  27.  
  28.         function handleResponse()
  29.         {    
  30.             if (http.readyState == 4)
  31.             {
  32.                 var response = http.responseText;
  33.                 document.getElementById('flashcontent').innerHTML=response;
  34.             }
  35.         }
  36.  
  37.          sendReq('http://158.49.247.14/caceresvirtual/contenido/abadia/flash/TourWeaver_Abadia.html');
  38.  
  39.         </script>
  40.         <p>Adios</p>
  41. </body>
  42. </html>