Commit bf6f7e7a authored by Ariel Flesler's avatar Ariel Flesler

jquery ajax: closes #3231. The ajax setting 'dataFilter' can also parse the response.

parent 9d9c4d2a
...@@ -480,6 +480,9 @@ jQuery.extend({ ...@@ -480,6 +480,9 @@ jQuery.extend({
if( s && s.dataFilter ) if( s && s.dataFilter )
data = s.dataFilter( data, type ); data = s.dataFilter( data, type );
// The filter can actually parse the response
if( typeof data == 'string' ){
// If the type is "script", eval it in global context // If the type is "script", eval it in global context
if ( type == "script" ) if ( type == "script" )
jQuery.globalEval( data ); jQuery.globalEval( data );
...@@ -487,6 +490,7 @@ jQuery.extend({ ...@@ -487,6 +490,7 @@ jQuery.extend({
// Get the JavaScript object, if JSON is used. // Get the JavaScript object, if JSON is used.
if ( type == "json" ) if ( type == "json" )
data = eval("(" + data + ")"); data = eval("(" + data + ")");
}
return data; return data;
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment