我正在开发一个简单的firefox工具与firefox-addon SDK,显示一些存储的数据。
这是列表面板的代码:
var list = panels.Panel({
width: 600,
height: 500,
contentURL: data.url('list/list.html'),
contentScriptFile: [data.url('jquery-1.10.1.js'),
data.url('list/list.js')],
contentScriptWhen: 'ready',
onShow: function() {
this.postMessage('focus');
},
onMessage: function(message) {
require('sdk/tabs').open(message);
}
});这是list.js的代码:
$.get("http://localHost:0000/clips", function(data) {
console.log( "done");
//do something with data
}但它不起作用。未显示消息"done“。
我也尝试使用jQuery.getJSON()方法,但它不起作用。
我确信服务器端发送的数据是正确的,因为在url上我可以看到它。
为什么list.js类不能执行$.get()方法?
发布于 2013-07-24 00:22:37
内容脚本遵循同源策略。从main.js读取数据。
https://stackoverflow.com/questions/17812030
复制相似问题