\n\n改成Greasemonkey脚本就出错了\n// ==UserScript==\n// @name Hello World\n// @description 暂无描述\n// @require\nhttp://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.3.min.js\n// @include *\n// ==/UserScript==\n$.getJSON(\"JSONP网络路径\", function(json){alert(\"JSON Data: \" + json.translation);})\nGreasemonkey脚本firebug调试时提示错误如下:\nReferenceError: jQuery203016154597985419905_1435415657339 is not defined\njQuery203016154597985419905_1435415657339({\"translation\":[\"酷\"],\"basic\":{\"us-phonetic\":\"kul\",\"phonetic\":\"kuːl\",\"uk-phonetic\":\"kuːl\",\"explains\":[\"n. 凉爽;凉爽的空气\",\"adj. 凉爽的;冷静的;出色的\",\"vt. 使\\u2026冷却;使\\u2026平静下来\",\"vi. 变凉;平息\",\"adv. 冷静地\",\"n. (Cool)人名;(法)科尔;(英)库尔\"]},\"query\":\"cool\",\"errorCode\":0,\"web\":[{\"value\":[\"酷\",\"凉爽的\",\"冷静\"],\"key\":\"Cool\"},{\"value\":[\"冷爵士乐\",\"冷爵士\",\"酷派爵士\"],\"key\":\"Cool jazz\"},{\"value\":[\"用烘干机低温烘干\",\"打冷风\",\"用烘焙机低温烘焙\"],\"key\":\"Tumble Cool\"}]});", "datePublished": "2015-06-27T14:44:54Z", "commentCount": 3, "mainEntityOfPage": "https://www.v2ex.com/t/201641", "author": {"url": "https://www.v2ex.com/member/upufo", "@type": "Person", "name": "upufo"}, "headline": "jquery 的跨域.getJSON 本地调试正常,整合到 Greasemonkey 怎么就提示 is not defined 了?", "url": "https://www.v2ex.com/t/201641", "isPartOf": {"url": "https://www.v2ex.com/go/qna", "@type": "WebPage", "name": "问与答"}, "@context": "https://schema.org", "@type": "DiscussionForumPosting"}
代码本地调试可以正确回调alert弹窗显示JSONP中的内容 可是一旦整合在Greasemonkey中就变成函数没有被定义了.这是什么问题?
<script src="http://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.3.min.js"></script>
// ==UserScript==
// @name Hello World
// @description 暂无描述
// @require http://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.3.min.js
// @include *
// ==/UserScript==
Greasemonkey脚本firebug调试时提示错误如下:
ReferenceError: jQuery203016154597985419905_1435415657339 is not defined
jQuery203016154597985419905_1435415657339({"translation":["酷"],"basic":{"us-phonetic":"kul","phonetic":"kuːl","uk-phonetic":"kuːl","explains":["n. 凉爽;凉爽的空气","adj. 凉爽的;冷静的;出色的","vt. 使\u2026冷却;使\u2026平静下来","vi. 变凉;平息","adv. 冷静地","n. (Cool)人名;(法)科尔;(英)库尔"]},"query":"cool","errorCode":0,"web":[{"value":["酷","凉爽的","冷静"],"key":"Cool"},{"value":["冷爵士乐","冷爵士","酷派爵士"],"key":"Cool jazz"},{"value":["用烘干机低温烘干","打冷风","用烘焙机低温烘焙"],"key":"Tumble Cool"}]});