Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/07/2014, 08:52
Avatar de Salome
Salome
 
Fecha de Ingreso: noviembre-2002
Ubicación: Colombia
Mensajes: 1.032
Antigüedad: 21 años, 5 meses
Puntos: 1
Abrir contenido externo HTML en un div contenedor

Hola a tod@s...

Estoy intentando abrir páginas html en un div contenedor, es decir, tengo una página index, la cual tiene un menú que llama a otras páginas html, la idea es que el contenido de esas páginas se cargue en la que tengo el menú en un div contenedor.

Todo marcha bien en internet explorer y en mozilla pero en chrome no, este es mi código:

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script type="text/javascript">
$(document).ready(function(){
   $("#nav a").each(function(){
      var href = $(this).attr("href");
      $(this).attr({ href: "#"});
      $(this).click(function(){
         $("#show").load(href);
      });
   });
});
</script>
</head>

<body>
<ul id="nav">
   <li><a href="servicios.html">Servicios</a></li>
   <li><a href="dos.htm">Enlace Dos</a></li>
   <li><a href="link.htm">Otro link</a></li>
   <li><a href="1337.htm">1337</a></li>
   <li><a href="creacionismo.htm">iDIotas</a></li>
</ul>

<div id="show">
</div>
</body>
</html> 
El error que me sale en Chrome (Que hace que no cargue el contenido) es el siguiente:

Código:
XMLHttpRequest cannot load file:///C:/Users/Salome/Desktop/Prueba/servicios.html. Received an invalid response. Origin 'null' is therefore not allowed access.