Note that there are some explanatory texts on larger screens.

plurals
  1. POShould I still be using jquery .getJson in 1.4.2?
    text
    copied!<p>I was looking at the 14 days of jquery</p> <p><a href="http://jquery14.com/day-01/jquery-14" rel="nofollow noreferrer">http://jquery14.com/day-01/jquery-14</a></p> <p>and I saw this and it got me to wondering is there a point to use getJson anymore? </p> <blockquote> <p>JSON and script types auto-detected by content-type (jQuery.ajax Documentation, Commit 1, Commit 2)</p> <p>If the response to an Ajax request is returned with a JSON mime type (application/json), the dataType defaults to “json” (if no dataType is specified). Additionally, if the response to an Ajax request is returned with a JavaScript mime type (text/javascript or application/x-javascript) , the dataType defaults to “script” (if no dataType is specified), causing the script to automatically execute.</p> </blockquote> <p>First I can see such a huge benefit of this. In jquery 1.3 I came to a situation where in some cases I would return a partial view and some cases I would return a json result (asp.net mvc). </p> <p>It worked in firefox but in no other browser and one of the problems was I basically had to tell jquery to either do json or text/html. </p> <p>With it automatically detecting I could get away with this. Anyways I found a solution around this at that time.</p> <p>So now it just makes me wonder if there is any point to using GetJson.</p> <p>I am also unsure how to set these JavaScript mime types? I am assuming that if you return a JsonResult from asp.net mvc it will set it. but I am not sure if I was just sending a text result if it would be set( I am not sure if ContentResult would set this).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload