Hi,
I am calling xml into a html page using jquery. I am using jquery to ensure than Firefox,chrome and IE all render the content the same.
I also want to display the html as content in a tabpanel....but the xml is not rendering...only the title.
can anyone say why this is?
thanks,
Rob
HTML Code:
<!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" /> <link rel="stylesheet" type="text/css" media="all" href="jquery/style.css" /> <script type="text/javascript" src="jquery/jquery-1.6.2.js"></script> <title>Reading XML with jQuery</title> <script> $(document).ready(function(){ $.ajax({ type: "GET", url: "test.xml", dataType: "xml", success: function(xml) { $(xml).find('site').each(function(){ var id = $(this).attr('id'); var title = $(this).find('title').text(); var url = $(this).find('url').text(); $('<div class="items" id="link_'+id+'"></div>').html('<a href="'+url+'">'+title+'</a>').appendTo('#page-wrap'); $(this).find('desc').each(function(){ var brief = $(this).find('brief').text(); var long = $(this).find('long').text(); $('<div class="brief"></div>').html(brief).appendTo('#link_'+id); $('<div class="long"></div>').html(long).appendTo('#link_'+id); }); }); } }); }); </script> </head> <body> <div id="page-wrap"> <h1>Reading XML with jQuery</h1> </div> </body> </html>
[CODE]
<?xml version="1.0" encoding="iso-8859-1"?> <sites> <site id="0"> <title>Think2Loud</title> <url>http://www.think2loud.com</url> <desc> <brief>this is the brief description.</brief> <long>...and this is the long description. See how long it is :)</long> </desc> </site> <site id="2"> <title>jaredharbour.com</title> <url>http://www.jaredharbour.com</url> <desc> <brief>this is the brief description.</brief> <long>...and this is the long description. See how long it is :)</long> </desc> </site> <site id="3"> <title>Css Tricks</title> <url>http://www.css-tricks.com</url> <desc> <brief>this is the brief description.</brief> <long>...and this is the long description. See how long it is :)</long> </desc> </site> </sites>[/CODE]