Foros del Web » Programando para Internet » Javascript » Frameworks JS »

función $.AJAX no recibe imagenes

Estas en el tema de función $.AJAX no recibe imagenes en el foro de Frameworks JS en Foros del Web. Hola foreros muy buenas. Mirar, tengo esta función: @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código Javascript : Ver original function recviv ( idcomen ) {         ...
  #1 (permalink)  
Antiguo 10/03/2012, 11:29
 
Fecha de Ingreso: mayo-2009
Mensajes: 35
Antigüedad: 14 años, 10 meses
Puntos: 1
función $.AJAX no recibe imagenes

Hola foreros muy buenas.
Mirar, tengo esta función:

Código Javascript:
Ver original
  1. function recviv(idcomen){
  2.         $.ajax({
  3.         type: 'POST',
  4.         url: 'http://localhost/pagina/comen',
  5.         success: function(resp){
  6.             $('#comentario').html(resp);
  7.             }
  8.         });
  9.     }

La función recibe como respuesta HTML, esta función siempre va de maravilla excepto cuando en el código HTML va una imagen <img>, a partir de aquí el resto de código HTML ya no me lo muestra.
La ruta de la imagen está bien por que si yo cargo esa respuesta HTMlL de forma independiente si me funciona, no sé donde puede estar el fallo. A ver si me podeis echar una mano.
  #2 (permalink)  
Antiguo 10/03/2012, 14:52
Avatar de Naahuel  
Fecha de Ingreso: marzo-2011
Ubicación: localhost
Mensajes: 796
Antigüedad: 13 años, 1 mes
Puntos: 192
Respuesta: función $.AJAX no recibe imagenes

Si realmente es como decís, el problema tiene que estar en el archivo que te provee del html ('http://localhost/pagina/comen').

El código que tenés ahí está perfecto a simple vista.
__________________
nahueljose.com.ar
  #3 (permalink)  
Antiguo 10/03/2012, 15:09
Avatar de Naahuel  
Fecha de Ingreso: marzo-2011
Ubicación: localhost
Mensajes: 796
Antigüedad: 13 años, 1 mes
Puntos: 192
Respuesta: función $.AJAX no recibe imagenes

Ejemplo: http://nahueljose.com.ar/ejemplos/ajax-test/

index.html
Código XML:
Ver original
  1. <!doctype html>
  2. <html>
  3. <head>
  4.     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  5.     <script type="text/javascript">
  6.         $(function(){
  7.             $('.get-html').click(function(e){
  8.                 e.preventDefault();
  9.                 $.ajax({
  10.                     type: 'POST',
  11.                     url: $(this).attr('href'),
  12.                     success: function(resp){
  13.                         $('#comentario').html(resp);
  14.                     }
  15.                 });
  16.             });
  17.         });
  18.     </script>
  19.     <title>Prueba de ajax</title>
  20. </head>
  21. <body>
  22.     <p><a class="get-html" href="imagenes.html">Click ac&aacute; para obtener un poco de HTML con im&aacute;genes con AJAX</a></p>
  23.     <div id="comentario"></div>
  24. </body>
  25. </html>

imagenes.html

Código HTML:
Ver original
  1. <!doctype html>
  2.     <title>Imagenes</title>
  3. </head>
  4.     <div id="contenedor">          
  5.         <p>Lorem ipsum dolor sit amet, tempore Quaere allocutus ait regem consolatus dum animae tuae designaverant ut a civitas ex quae. Non potentia feugiat o sanguine instaret terrae in. Volentes mihi servitute meam contra me naufragus qui non potentiae. Audite deo hanc cuius ad nomine Stranguillio eam eos cui sed esse haec in. Navibus celebrent duo elitr qui enim.</p>
  6.         <p><img src="http://placehold.it/300x300" alt="Imagen Loca" title="Imagen Loca" /></p>
  7.         <p>Lorem ipsum dolor sit amet, tempore Quaere allocutus ait regem consolatus dum animae tuae designaverant ut a civitas ex quae. Non potentia feugiat o sanguine instaret terrae in. Volentes mihi servitute meam contra me naufragus qui non potentiae. Audite deo hanc cuius ad nomine Stranguillio eam eos cui sed esse haec in. Navibus celebrent duo elitr qui enim.</p>
  8.         <p><img src="http://placehold.it/200x200" alt="Imagen Loca" title="Imagen Loca" /></p>
  9.     </div>
  10. </body>
  11. </html>
__________________
nahueljose.com.ar

Etiquetas: jquery
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:53.