ここでは完全に初心者です。私はjqueryライブラリを持っています。json を返す API を呼び出します。jquery ライブラリ内の parseJSON 関数を使用して解析したいと考えています。簡単に言えば、私はそうする方法がわかりません。
jquery ライブラリ内で関数を見つけることができます。次のようになります。
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
jQuery.error( "Invalid JSON: " + data );
},
それを介してjsonを送信するにはどうすればよいですか?