views:

526

answers:

1

I'm transferring fragments of HTML via Ajax. Safari (4.0.5) reports: "Resource interpreted as other but transferred with MIME type text/html."

The file name of the file I get has a .html extension. The server does set the header for this:

Content-Type:text/html

As I said, the content is a fragment of HTML, which is injected into the page (with jQuery).

The contents of the file look like:

<html>
... some valid html ...
</html>

What else might Safari need to see to make it interpret the received content as HTML?

TIA.

-- addition --

Here's the Ajax jQuery code:

$.ajax({
    url: url, 
    dataType: 'text',
    async: false,
    success: function(json) {
        callback(json);
    },
    error: function(request, status, error) {
        callback(undefined);
    }
});
A: 

Thanks to Pekka for asking me to show the code -- I noticed several problems, made changes, and one of them (I suspect I know which) has fixed the problem:

$.ajax({
    url: url, 
    dataType: 'html',            //  <-- changed the dataType to "html"
    async: true,
    success: function(data) {
        callback(data);
    },
    error: function(request, status, error) {
        callback(undefined);
    }
});
Zhami