Reputation: 303
The jQuery library has a built in function called .overrideMimeType()
. Why is this a beneficial thing to do? What kind of issues may arise if I don't do this? It seems to crop up quite frequently, but I can't find a good explanation via Google.
Thank you for your help.
Upvotes: 0
Views: 45
Reputation: 944564
It hacks around web services which lie about what sort of content they are serving.
Most commonly, this involves PHP scripts since PHP defaults to claiming Content-Type: text/html
and many PHP authors don't know they should header("Content-Type: application/json");
before they echo json_encode($some_data);
.
Upvotes: 2