I’ve tried this several times and does not work in Internet Explorer 6, 7, or 8. Works in Firefox. What I am doing is using $.ajax to insert data into my document. Below is my code:
//Example using jQuery
$(document).ready(function() {
$('li a.example').click(function(){
$.ajax({
type: "GET",
url: "news-stories.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('news_story').each(function(){
var title = $(this).find('title').text();
var company = $(this).find('story_company').text();
var author = $(this).find('story_author').text();
$('<div class="items" id="link_'+author+'"></div>')
.html('<a href="'+company+'">'+title+'</a>')
.appendTo('#top-main-content');
/*$(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);
});*/
});
}
});
});
});
I am attempting to load this data with a click function into #top-main-content. Can anyone tell me why this is not working?
I am loading an .xml document styled with .xsl into the browser as news-stories.xml, I am declaring this function within myt news-stories-style.xsl. Please help.
Mike
I had a problem with this – parsing XML from within jQuery. Decided that I didn’t need jQuery for the XML stuff. so I just loaded it into an XMLDocument, and partied on it that way, using regular XMLDOM methods.