I'm doing a pretty simply ajax call using jQuery (in Wordpress) - using GET to fetch the contents of a page, then reading the response into a jQuery object. This works fine in every browser except IE8 (not concerned about IE6/7. The relevant code is identical to what I have used in previous sites, all of which work in IE8. Here's the code:
var ajax_params = {
url: relative_url,
type: 'GET',
dataType: 'html',
data: {},
success: function(data, textStatus, xhr) {
// create jquery element from html string
data = $('<div/>').append(data);
pre($(data).find('#content'));
pre($('#content'));
plugin.replace_content(data, relative_url);
},
};
plugin.ajax_call = $.ajax(ajax_params);
The pre() functions are just calls to console.log, and I'm using firebug lite in IE8 to debug. I've determined that the ajax call is working, and the HTML of the requested page is being returned successfully in the data
variable. It's getting hung up on data = $('<div/>').append(data)
, where the result is an empty div. As I said, this exact code works on other sites, so I'm at a loss to explain this. I've downgraded the jQuery version to 1.8.3 to match what is on the other sites to no avail.
Any ideas?