Javascript 如何使用Enyo 2.0 WebService对象

Javascript 如何使用Enyo 2.0 WebService对象,javascript,web-services,chromium,enyo,Javascript,Web Services,Chromium,Enyo,我正在构建一个Campfire客户端,它将在WebOS中运行,并作为Chrome桌面web应用程序运行。 我有以下代码: logIn: function(){ this.apiToken = this.$.loginScreen.$.apiToken.getValue(); this.subdomain = this.$.loginScreen.$.subdomain.getValue(); this.fullURL = 'https://' + this.subdoma

我正在构建一个Campfire客户端,它将在WebOS中运行,并作为Chrome桌面web应用程序运行。 我有以下代码:

logIn: function(){
    this.apiToken = this.$.loginScreen.$.apiToken.getValue();
    this.subdomain = this.$.loginScreen.$.subdomain.getValue();
    this.fullURL = 'https://' + this.subdomain + '.campfirenow.com/';
    this.$.roomService.url = this.fullURL + 'rooms.json';
    var response = this.$.roomService.send({'Authorization': "Bearer " + this.apiToken, 'Access-Control-Allow-Origin': this.subdomain + '.campfirenow.com'});
“客房服务”是这样的:

{name: "roomService", kind: "enyo.WebService", url: null, onResponse: "successfulAlert", onError: "someFailure"}
在Chromium中,我不断得到以下XMLHttpRequest错误:

Origin null is not allowed by Access-Control-Allow-Origin.

有什么想法吗?

您可能想看看这个问题:


您试图从文件://URL.

运行此程序时被阻止。另外,如果您是从服务器运行此程序,如果Campfire不允许通过AJAX跨站点访问其API,或者用户的浏览器不支持跨站点AJAX语义,您可能仍会被阻止。我在Chromium上运行时禁用了安全功能。也许我可以在我的应用程序中嵌入一个node.js服务器并通过这种方式进行调用?我更愿意以某种方式使用Web服务。