Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#7047 closed bug (worksforme)

ie7/8 ajax bug with html content type

Reported by: doccoder Owned by:
Priority: Milestone: 1.4.3
Component: ajax Version: 1.4.2
Keywords: ajax, html, ie7, ie8 Cc:
Blocked by: Blocking:

Description

Provided by Tim Nichols: This happens on both IE7 and IE8 - if you make an ajax call and use html as your content type, the call fails. (text, json, and others work fine). It does not happen on IE6 or FF.

Work arounds: Option 1- return text instead of html, then use:

success: function(data) {

xhr = (new DOMParser()).parseFromString(data, ‘text/html’);

… }

Option 2- overload the jQuery.ajaxSetup() function.

IE 7/8 fix for html ajax calls... jQuery.ajaxSetup({ xhr:function() {

try {

if (window.ActiveXObject)

return new window.ActiveXObject("Microsoft.XMLHTTP");

} catch(e) {} return new window.XMLHttpRequest(); }

});

Change History (1)

comment:1 Changed 13 years ago by dmethvin

Resolution: worksforme
Status: newclosed

There's no test case, but in general the HTML data type works. If DOMParser works and injection via innerHTML (in $.ajax) does not, then most likely IE doesn't like the HTML because it has validity problems.

Note: See TracTickets for help on using tickets.