Ver Mensaje Individual
  #11 (permalink)  
Antiguo 20/09/2014, 11:24
NDOmx
 
Fecha de Ingreso: septiembre-2014
Mensajes: 2
Antigüedad: 9 años, 7 meses
Puntos: 0
Respuesta: Abrir contenido externo HTML en un div contenedor

Es cierto lo que te comentan. No es con un servidor HTTP para que lo puedas hacer con ajax.
También es correcto que si no puedes con ajax lo puedes solucionar con iframes.

Te dejo el que funciona con iframe.

Saludos.
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Untitled Document</title>
  5. <script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
  6. <script type="text/javascript">
  7. $(document).ready(function(){
  8.    $("#nav a").each(function(){
  9.       var href = $(this).attr("href");
  10.       $(this).attr({ href: "#"});
  11.       $(this).click(function(){
  12.          //$("#show").load(href);
  13.          $("#show").html('<iframe src="' + href + '" style="border:none;"></iframe> ');
  14.       });
  15.    });
  16. });
  17. </head>
  18.  
  19. <ul id="nav">
  20.    <li><a href="servicios.html">Servicios</a></li>
  21.    <li><a href="dos.htm">Enlace Dos</a></li>
  22.    <li><a href="link.htm">Otro link</a></li>
  23.    <li><a href="1337.htm">1337</a></li>
  24.    <li><a href="creacionismo.htm">iDIotas</a></li>
  25. </ul>
  26.  
  27. <div id="show">
  28. </div>
  29. </body>
  30. </html>