aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax.js
diff options
context:
space:
mode:
authorAriel Flesler <aflesler@gmail.com>2008-08-07 20:41:05 +0000
committerAriel Flesler <aflesler@gmail.com>2008-08-07 20:41:05 +0000
commitbf6f7e7a63cb3d43da2fcc98c81690d2dc1ac54b (patch)
tree8c311f29d7176f0bb6f5ef079468642a51626182 /src/ajax.js
parent9d9c4d2a516216378f4eec0bc27a2cc1cfc78d53 (diff)
downloadjquery-bf6f7e7a63cb3d43da2fcc98c81690d2dc1ac54b.tar.gz
jquery-bf6f7e7a63cb3d43da2fcc98c81690d2dc1ac54b.zip
jquery ajax: closes #3231. The ajax setting 'dataFilter' can also parse the response.
Diffstat (limited to 'src/ajax.js')
-rw-r--r--src/ajax.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/ajax.js b/src/ajax.js
index a5ee4b7cc..885c8193e 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;
},