views:

55

answers:

1

I'm trying to GET an HTML document using the jQuery ajax() method.

When I try and parse the returned data using $(data) all browsers other than IE are returning a DOM element, where as IE is returning NULL.

I've checked 'data' and it's a string as expected.

Any ideas what might cause this? I'm guessing it could be errors in the markup being pulled in, but I can't spot anything in the validation?

I'm using jQuery 1.4.2.

  jQuery.ajax({
    url: url,
    cache: false,
    contentType: 'html',
    processData: false,
    success: function(data) {
      console.log($(data)); 
    }
  });

Thanks in advance.

A: 

Be sure that your url variable links not to xhtml page otherwise there are many problems with IE.

Desperadeus
If the response is XHTML do you mean?
Dan Steele
Yep, if the response is XHTML, then IE will not parse it into Document object and returns only simple string of the response. To bypass it check the article http://www.hiteshagrawal.com/javascript/convert-xml-document-to-string-in-javascript. The problem is in XHTML, contentType (jQuery) and IE. Hope these will help.
Desperadeus