Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/09/2011, 14:12
nanshan
 
Fecha de Ingreso: septiembre-2009
Ubicación: España
Mensajes: 136
Antigüedad: 14 años, 7 meses
Puntos: 0
AJAX, Object has no method 'getElementById'

Hola, buenas noches, estoy intentado obtener un div con ajax y JQuery, he hecho una llamada con ajax y obtengo el siguiente problema, obtengo todo el html, pero no puede obtener el div, al principio y al final del codigo pone el fallo "Uncaught TypeError: Object has no method 'getElementById'" no entiendo porque no puedo obtener el div, al final del post he puesto como es la llamada con AJAX

Código PHP:
Uncaught TypeErrorObject 

<!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>Documento sin título</title>
</
head>
<
body>
<
xmp style="display:none" id="data">
{
    
"glossary": {
        
"title""example glossary",
        
"GlossDiv": {
            
"title""S",
            
"GlossList": {
                
"GlossEntry": {
                    
"ID""SGML",
                    
"SortAs""SGML",
                    
"GlossTerm""Standard Generalized Markup Language",
                    
"Acronym""SGML",
                    
"Abbrev""ISO 8879:1986",
                    
"GlossDef": {
                        
"para""A meta-markup language, used to create markup languages such as DocBook.",
                        
"GlossSeeAlso": ["GML""XML"]
                    },
                    
"GlossSee""markup"
                
}
            }
        }
    }
}
</
xmp>
</
body>
</
html>

 
has no method 'getElementById' 
Código PHP:
$.ajax({
            
url:'/data.html',
            
success: function(r){
var 
data2 = $(r).find('xmp#data');
alert(data2);

            }
       }); 
He buscado por google y no encuentro nada que me ayude a solucionarlo :S

Alguien puede ayudarme con esto?

Muchas gracias, un saludo