【发布时间】:2011-04-08 03:53:37
【问题描述】:
我正在尝试使用 Qooxdoo 对 CouchDB 进行 AJAX 调用,但据我所知,我的请求对象上似乎没有触发任何事件(即控制台上没有出现任何内容,也没有出现警报) .谁能告诉我应该发生什么/我做错了什么?
(这都在我班级的'main'方法中)
var req = new qx.io.remote.Request('http://localhost:5984/japanese/words', 'GET', 'application/json').set({crossDomain:true,timeout:0});
this.debug("Testing");
req.addListener("created", function(e) {
this.debug("Created");
alert(e.getContent());
}, this);
req.addListener("sending", function(e) {
this.debug("Configured");
alert(e.getContent());
}, this);
...
(这只是一个示例 - 我已经为我能想到的所有事件添加了一个类似的侦听器,但控制台上没有出现任何内容)
我的服务器运行 Ubuntu 10.10 和 Qooxdoo 1.3。
编辑:
现在尝试请求“http://localhost/languages/test.php”(我的应用程序位于“http://localhost/languages/index.html”)并且除了测试之外仍然没有出现任何警报我把任何事件放在外面。我现在的请求是:new qx.io.remote.Request('http://localhost/languages/test.php', 'GET', 'application/json'); 当我在浏览器中访问 PHP 文件时,它返回了有效的 JSON。这肯定行得通吗?
【问题讨论】:
-
为了安全起见(您的示例未显示)...您是否真的在代码中调用了
send()方法?
标签: javascript ajax request couchdb qooxdoo