mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
jquery ajax: closes #3231. The ajax setting 'dataFilter' can also parse the response.
This commit is contained in:
parent
9d9c4d2a51
commit
bf6f7e7a63
16
src/ajax.js
16
src/ajax.js
@ -480,14 +480,18 @@ jQuery.extend({
|
|||||||
if( s && s.dataFilter )
|
if( s && s.dataFilter )
|
||||||
data = s.dataFilter( data, type );
|
data = s.dataFilter( data, type );
|
||||||
|
|
||||||
// If the type is "script", eval it in global context
|
// The filter can actually parse the response
|
||||||
if ( type == "script" )
|
if( typeof data == 'string' ){
|
||||||
jQuery.globalEval( data );
|
|
||||||
|
|
||||||
// Get the JavaScript object, if JSON is used.
|
// If the type is "script", eval it in global context
|
||||||
if ( type == "json" )
|
if ( type == "script" )
|
||||||
data = eval("(" + data + ")");
|
jQuery.globalEval( data );
|
||||||
|
|
||||||
|
// Get the JavaScript object, if JSON is used.
|
||||||
|
if ( type == "json" )
|
||||||
|
data = eval("(" + data + ")");
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user