Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/09/2011, 10:41
nanshan
 
Fecha de Ingreso: septiembre-2009
Ubicación: España
Mensajes: 136
Antigüedad: 14 años, 7 meses
Puntos: 0
Ajax y parser html

Hola buenas, tengo un problema y es que hago una peticion con Ajax a un html que tiene dentro un JSON de esta manera:

Código:
<!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>
Como se ve, la etiqueta <xmp style="display:none" id="data"> envuelve al JSON, ¿como puedo hacer un parser para obtener solamente lo que hay dentro de esa etiqueta? es decir obtener solo el JSON usando una llamada de ajax como la siguiente:

Código:
$.ajax({
	  	url: data.html
		success: function(r){
    }            
});
Gracias, un saludo :)