Hi,

Firstly, let me apologize if this has been discussed before. I have
searched the group and couldn't find anything on the subject.

Now, to my question. Am I correct to assume that the jQuery.ajax
function pays no heed to the Content-Type response header it receives
from the server? If so, can I ask why? For instance, if the server
sends 'application/json', it is fairly safe to assume that the
response will be in JSON format and should therefore be eval'd.

I have a situation where I do not know beforehand, what type of data
the server will return, and therefore cannot specify a dataType
parameter. In this case, I would like jQuery to parse the response, if
it receives a 'Content-Type' header of 'application/json', and only
then. If the header received is 'text/html', the response should not
be parsed.

Is there a reason why the 'Content-Type' response header is being
ignored, when the dataType parameter is not specified? Or is this not
the case and I am missing something?

Thanks!

Reply via email to