I watched 14 days jquery
http://jquery14.com/day-01/jquery-14
And I saw this, and I wondered if it makes sense to use getJson?
JSON and script are automatically recognized by content-type (jQuery.ajax Documentation, Commit 1, Commit 2)
If the response to the Ajax request is returned with the MIM JSON type (application / json), the dataType defaults to "json" (if no data of the type are specified). In addition, if the response to the Ajax request is returned with a JavaScript mime type (text / javascript or application / x-javascript), the default dataType is βscriptβ (if there is no dataType), resulting in a script to automatically execute.
At first I see such a huge benefit from this. In jQuery 1.3, I came to a situation where in some cases I would return a partial view, and in some cases I would return a json result (asp.net mvc).
It worked in firefox, but in no other browser, and one of the problems was that I basically had to set jquery to either json or text / html.
With it, it is automatically detected that I could handle this. In any case, I found a solution around this at the time.
So now I'm just wondering if it makes sense to use GetJson.
I'm also not sure how to set these mime JavaScript types? I assume that if you return JsonResult from asp.net mvc, it will install it. but I'm not sure if I'm just sending a text result if it is set (I'm not sure if ContentResult would set this).
source share