2015-06-10 56 views
1

我想要使用外部JavaScript文件,使用jQuery的铬扩展。但我一直得到这个愚蠢的错误。

Screenshot of error in chrome inspector.

任何帮助表示赞赏感谢!

popup.js

$(document).ready(function() { 
    $.ajax({url: "http://www.google.com", success: function(result) { 
    $("#report-details").html(result); 
    }}); 
}); 

popup.html

<!doctype html> 
<html> 
    <head> 
    <title>TEST</title> 
    <script src="popup.js"></script> 
    <script src='./js/jquery.min.js'></script> 
    <script src='./js/jquery.js'></script> 
    </head> 
    <body> 
    <h1>TEST</h1> 
    <div id="report-details"> 
    </div> 
    </body> 
</html> 

manifest.json的

{ 
    "manifest_version": 2, 
    "name": "my ext", 
    "description": "fun ext", 
    "version": "1.0", 
    "browser_action": { 
    "default_icon": "icon.png", 
    "default_popup": "popup.html" 
    }, 
    "permissions": [ 
    "activeTab" 
    ], 
    "content_scripts": [ 
    { 
     "matches": ["http://*/*","https://*/*"], 
     "js": ["js/jquery.min.js"] 
    } 
    ] 
} 

任何帮助是GRE非常感谢。 (我道歉,如果这是一个小白错误)

回答

3

首先加载jQuery插件后,您可以加载您popup.js

<script src='./js/jquery.min.js'></script> 
<script src="popup.js"></script> 

注:不需要加载2 jQuery插件

+0

哇感谢您! (完全是noob错误) – Changerrs

相关问题