Buenos días, recientemente he optado por ajax para cargar contenidos en un div, hasta el momento funciona bien excepto por que no me carga las imágenes; her revisado la ruta y todo lo tengo en un localhost; de ajax re nada jeje espero me puedan colaborar.
aqui el codigo que tengo:
Código HTML:
Ver original<script type="text/javascript"> function ajaxFunction() {
var xmlHttp;
try {
xmlHttp=new XMLHttpRequest();
return xmlHttp;
} catch (e) {
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
return xmlHttp;
} catch (e) {
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
return xmlHttp;
} catch (e) {
alert("Tu navegador no soporta AJAX!");
return false;
}}}
}
function Enviar(_pagina,capa) {
var ajax;
ajax = ajaxFunction();
ajax.open("POST", _pagina, true);
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.onreadystatechange = function() {
if (ajax.readyState==1){
document.getElementById(capa).innerHTML = " Aguarde por favor...";
}
if (ajax.readyState == 4) {
document.getElementById(capa).innerHTML=ajax.responseText;
}}
ajax.send(null);
}
<!--lo anterior en head, lo siguiente en los vinculos (body)-->
<img src="img/recientes/head-noti.png" id="head-noti"/> <a href="#"><img width="55" height="55" src="img/recientes/7.jpg"/></a> <h5><a href="javascript:Enviar('noti-load/siete.html','contenido' )" title="cienmil fans">Más de 100.000 fanáticos de chica vampiro en Italia
</a> <a href="#"><img width="55" height="55" src="img/recientes/6.jpg"/></a> <h5><a href="javascript:Enviar('noti-load/seis.html', 'contenido' )" title="Nominados a kids choice awards 2014">Chica vampiro y varios personajes nominados a Kid Choice Awards Colombia 2014
</a> <p>tabien texto de prueba que cambiará
</p>
<!--Y EN LOS ARCHIVOS EXTERNOS ESTA ASI:-->
<h1>Más de 100.000 fanáticos de chica vampiro en Italia
</h1> <img src="../img/recientes/seis.png"/>