X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fajax.js;h=885c8193e03341c37583d548b97d26be5b05b0c3;hb=bf6f7e7a63cb3d43da2fcc98c81690d2dc1ac54b;hp=a5ee4b7cc91efe69eb43aeeca90cfd9dfd8e5e4b;hpb=9d9c4d2a516216378f4eec0bc27a2cc1cfc78d53;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index a5ee4b7..885c819 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -480,14 +480,18 @@ jQuery.extend({ if( s && s.dataFilter ) data = s.dataFilter( data, type ); - // If the type is "script", eval it in global context - if ( type == "script" ) - jQuery.globalEval( data ); + // The filter can actually parse the response + if( typeof data == 'string' ){ - // Get the JavaScript object, if JSON is used. - if ( type == "json" ) - data = eval("(" + data + ")"); + // If the type is "script", eval it in global context + if ( type == "script" ) + jQuery.globalEval( data ); + // Get the JavaScript object, if JSON is used. + if ( type == "json" ) + data = eval("(" + data + ")"); + } + return data; },