开发者

Qooxdoo AJAX help - events not working?

I'm trying to make an AJAX call to CouchDB with Qooxdoo, but as far as I can tell no events seem to be firing on my request object (ie. Nothing is appearing on the console and no alerts are coming up). Can anyone tell me what should be happening/what I'm doing wrong?

(This is all in the 'main' method of my class)

  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);
  ...

(This is just a sample - I've added a similar listener for all the events I can think of but nothing is coming up on the console)

My server is running Ubuntu 10.10 with Qooxdoo 1.3.

Edit:

Now trying to request "http://localhost/languages/test.php" (my app is at "http://localhost/languages/index.html") and still no alerts are appearing except for the test one I put outside of any event. My request is now: new qx.io.remote.Request('http://localhost/languages/test.php', 'GET', 'application/json'); The P开发者_Go百科HP file is returning valid JSON when I access it in my browser. Surely this should work?


Cross-domain requests in qooxdoo use a script transport which doesn't fire events. Instead, your server needs to wrap the response data in a call to a static method. See the package documentation of qx.io.remote for details:

http://demo.qooxdoo.org/current/apiviewer/#qx.io.remote

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜