I thought result
will be a json object if the response header includes application/json
,
$.get(...,function(result){
//here result is a json object
});
But today I tried a earlier version of jQuery,found result is a string
.
So is it true that jQuery 1.6 automatically converts the result
to object(eval("("+result+")")
) for me开发者_运维知识库?
UPDATE
Here's the related header,but it turns out I have to eval it manually:
X-Content-Type-Options nosniff
Content-Type application/json; charset=EUC-JP
UPDATE
No doubt now,it's confirmed.
If the server sets the Content-Type: application/json
response header, jQuery automatically evals the result, and this is true even for older versions.
Yes, this feature doesn't exist in jquery 1.3.2
精彩评论