완전히 초보자입니다. jquery 라이브러리가 있습니다. json을 반환하는 api를 호출합니다. jQuery 라이브러리 내에서 parseJSON 함수를 사용하여 구문 분석하고 싶습니다. 간단히 말해서, 나는 그렇게하는 법을 모른다.JSON 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을 보내려면 어떻게합니까 : 나는 jQuery 라이브러리 내에서 기능을 찾을 수 있습니다
는, 그렇게 보이는? 당신이 jQuery.getJSON 기능을 사용하는 경우