解析 json 数据时遇到问题。下面是引发错误的函数
parseJSON: function( data ) {
//Attempt to parse using the native JSON parser first
if (window.JSON && window.JSON.parse) {
return window.JSON.parse( data ); //We are getting error from this line due to data is undefined
}
if (data === null) {
return data;
}
if ( typeof data === "string" ) {
data = jQuery.trim( data );
if ( data ) {
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
}
}
jQuery.error( "Invalid JSON: " + data );
}
提前致谢