wah*_*a31 7 ajax jquery json google-chrome-extension
我是一个新手并且正在研究google-chrome扩展,需要向服务器发出jquery ajax请求,加载一些html文档.我的服务器是Apache,使用XAMPP 1.7.3在localhost上运行.jquery是jquery-1.6.1.js.
当我使用标准浏览器(如http://localhost/Chrome/popup.html)加载它时,jquery ajax可以正常工作.它加载了html文档funtionaly.但是,问题是当我通过Google Chrome (谷歌浏览器11)扩展开发者模式中的"加载解压缩的扩展程序"打开我的扩展程序时.html文档不会加载.
任何人都可以帮助解决我的问题?
这是我的代码:
的manifest.json
{
"name": "Nyu Extension",
"version": "1.0",
"description": "My First Extension",
"permissions" : ["http://localhost/", "http://*/*"],
"browser_action": {
"default_icon": "N.png",
"popup": "popup.html"
}
}
Run Code Online (Sandbox Code Playgroud)
popup.html
...
function activeTab(tab)
{
document.getElementById("tab1").className = "";
document.getElementById("tab"+tab).className = "active";
if(tab == 1)
{
$.ajax({
url: "ssc/contentpage1.txt",
success: function(data) {
$('#content').html(data);
}
});
}
}
...
Run Code Online (Sandbox Code Playgroud)
如果有什么不妥,请告诉我..
| 归档时间: |
|
| 查看次数: |
7654 次 |
| 最近记录: |