X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fajax.js;h=91519d2892aa9edadf26f027c1105a422dd60e7f;hb=0645b71ee6139c19c2c5a488f16f50dc1c31e9ac;hp=b5adf2c7fdb44e43e719789e71d173f95d6863a2;hpb=3f648c4e3abe236b8ec6a19822313be794e5a9df;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index b5adf2c..91519d2 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -579,9 +579,11 @@ jQuery.extend({ // Get the JavaScript object, if JSON is used. if ( type === "json" ) { - if ( typeof JSON === "object" && JSON.parse ) { + // Try to use the native JSON parser first + try { data = JSON.parse( data ); - } else { + + } catch(e) { data = (new Function("return " + data))(); } }