i hope you can help me with this one. The code is supposed to display mysql data using a php script returning XML (the backend script works fine delivering good XML – checked with my previous question on Stack Overflow).
I’m using jQuery 1.4.2 to do a .get AJAX call – and i just can’t get Internet Explorer to display even a bit. Chrome, Safari, Chromium, FireFox and Opera work just fine here – i wonder what i did wrong ?
I checked the problem about IE and jQuery and i found this piece of code that could help but it doesn’t work :
function parseXml(xml)
{
if (jQuery.browser.msie)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.loadXML(xml);
xml = xmlDoc;
}
return xml;
}
Is there anything i can do to display my posts in Internet Explorer?
I put an “alert” at the beginning of the xml parsing function but Internet Explorer never gets there to display alert. Other browsers do. It seems it doesn’t even execute the
function(xml) { bazinga_getposts(xml); }
from jQuery .GET
Thanks for any idea! The IE version is 8
Here is the full code:
var ajax_content_left=$("#ajax_content_left");
var ajax_content_left_pagination=$('#ajax_content_left_pagination');
function parseXml(xml)
{
if (jQuery.browser.msie)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.loadXML(xml);
xml = xmlDoc;
}
return xml;
}
$.get("bazinga_blob/getposts.php",
{
category:"1",
post_tags:"",
language:"pl",
author:"1",
posts_per_page:"2",
current_page:"1",
order:"desc",
hard_limit:"",
show_hidden:"1"
}, function(xml) { bazinga_getposts(xml); },'xml');
function bazinga_getposts(xml)
{
alert('found it');
thexml=$(xml);
thexml=parseXml(thexml);
var fill_this='';
var fill_pagination='';
var ile_stron=thexml.find('LastPage').text();
thexml.find('Post').each(function()
{
fill_this+='<h1>'+thexml.find('PostTitle').text()+'</h1>';
fill_this+='<article>'+thexml.find('PostBody').text()+'</article>';
});
for (i=1;i<=ile_stron;i++)
{
fill_pagination+='<li><a href="#'+i+'">'+i+'</a></li>';
}
ajax_content_left.append(fill_this);
ajax_content_left_pagination.append(fill_pagination);
}
Maybe the returned content is invalid XML; see if it works with plain text. Also, try setting an error callback. If all else fails, you can try to debug it via Microsoft Script Editor.