Load XML via AJAX - IE8 not working
So I have this newsfeed system which works perfectly on all browsers..... except IE8! Surprise!
Now, the code I have was made by trial and error, so there might be some obvious coding issues which I don't know...
Here's the external JS file (I use jQuery 1.7.2 btw)
- $(document).ready(function(){
- $.ajax({
- type: "GET",
- url: "newsfeed_en.xml",
- dataType: "html",
- success: function(xml) {
- $(xml).find("element:first").each(function(){
- var year = $(this).find("year").text();
- var month = $(this).find("month").text();
- var day = $(this).find("day").text();
- var date = day+"-"+month+"-"+year;
- var newselement = '<div class="newsElement"><h4>'+date+'</h4><p>'+content+'</p></div>';
- $('#news h1').after(newselement);
- });
- $(xml).find("element:gt(0)").each(function(){
- var year = $(this).find("year").text();
- var month = $(this).find("month").text();
- var day = $(this).find("day").text();
- var date = day+"-"+month+"-"+year;
- var content = $(this).find("content").html();
- var newselement = '<div class="newsElement"><h4>'+date+'</h4><p>'+content+'</p></div>';
- $('#news #paneMoreNews').append(newselement);
- });
- });
- });
What it does is take the first ELEMENT and put it in one location, and all the others somewhere else.
Now I had to set datatype to HTML because some ELEMENT contain LINKS, but changing it to XML doesn't resolve the problem. Taking the ":first" away doesn't solve it either....
I searched this place, but none of the other solutions work.......
Many THANKS in advance!!!!!