그래서 Chrome 확장 프레임 독립적 인 코드 집합을 실행할 때 가짜 html 파일에서 일할 때 제대로 작동하지만 Chrome 확장 프로그램에서 실행하려고하면 위키 백과에서 이상한 콜백 함수가 내 API URL에 연결됩니다. .잡히지 않은 경우 Wikipedia API의 콜백 참조 오류?
http://en.wikipedia.org/w/api.php?action=query&titles=Girdling&format=json&prop=extracts&exintro=0&redirects&callback=jQuery1111023737464868463576_1402806465025
실제로 내 AJAX 호출에서 실행중인 내용.
var wikiUrl = "http://en.wikipedia.org/w/api.php?action=query&titles=Girdling&format=json&prop=extracts&exintro=0&redirects&callback=?"
$.ajax(wikiUrl,{
dataType: 'jsonp',
cache: true,
success: function(data){
//do things with the response data
}
나는 콘솔에서이 오류를 얻을 :
Uncaught ReferenceError: jQuery1111023737464868463576_1402806465025 is not defined
당신은 JSON 데이터가이 기능에 싸여 의심 할 수 있듯이 :
jQuery1111023737464868463576_1402806465025({"query":{"pages":{"1822951":{"pageid":1822951,"ns":0,"title":"Girdling","extract":"<p><b>Girdling</b>, also called <b>ring barking</b> or <b>ring-barking</b>, is the complete removal of a strip of bark (consisting of cork cambium, phloem, cambium and sometimes going into the xylem) from around the entire circumference of either a branch or trunk of a woody plant. Girdling results in the death of the entire tree over time. A branch completely girdled will fail and when the main trunk of a tree is girdled, the entire tree will die, if it cannot regrow from above to bridge the wound.</p>\n<p>Among the causes of girdling are human practices, including forestry, horticulture, and vandalism. Foresters use the practice of girdling to thin forests and orchardists use it as a cultural technique to yield larger fruit. Girdling can also be caused by herbivorous mammals feeding on plant bark and by birds and insects, both of which can effectively girdle a tree by boring rows of adjacent holes.</p>\n<p></p>"}}}})
그래서 어떻게 위키 피 디아의 API를 말할 않는 다른 함수가 작동하지 않을 때 success 함수를 실행하고 싶습니다. 나는 이미 내 URL에 콜백 설정 = 성공을 시도했다.