Bug Tracker

Changeset 5811

Show
Ignore:
Timestamp:
08/07/08 20:41:05 (3 weeks ago)
Author:
aflesler
Message:

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/ajax.js

    r5807 r5811  
    481481            data = s.dataFilter( data, type ); 
    482482 
    483         // If the type is "script", eval it in global context 
    484         if ( type == "script" ) 
    485             jQuery.globalEval( data ); 
    486  
    487         // Get the JavaScript object, if JSON is used. 
    488         if ( type == "json" ) 
    489             data = eval("(" + data + ")"); 
    490  
     483        // The filter can actually parse the response 
     484        if( typeof data == 'string' ){ 
     485 
     486            // If the type is "script", eval it in global context 
     487            if ( type == "script" ) 
     488                jQuery.globalEval( data ); 
     489 
     490            // Get the JavaScript object, if JSON is used. 
     491            if ( type == "json" ) 
     492                data = eval("(" + data + ")"); 
     493        } 
     494         
    491495        return data; 
    492496    },