When I'm sending AJAX query to my webApp, Qooxdoo cannot interpret the response correctly when server return response with header:
Content-Type: application/json; charset=utf-8
Here is sample code:
var req = new qx.io.remote.Request("http://localhost:8080/bm/login.json","POST","application/json");
req.setFormField('login',this.loginInput.getValue());
req.setFormField('password',this.passwordInput.getValue());
req.addListener("completed", function(response){
var result = response.getContent();
alert(result); // expected: object
alert(result.status); // expected: 200
}, this);
req.send();
In this case alert(result) returns to me null (should be object).
Qooxdoo app and server app runs on http://localhost:8080/
If I change mime-type header to:
Content-Type: text/html; charset=utf-8
everything works correctly.
When I add to firefox addition named JSONView then alert(result); returns to me:
<doctype html="">
<div id="json">
<ul class="obj collapsible">
<li>
<span class="prop">session_id</span>
:
<span class="string">"e4cfcd8e91c567cce3767375dd3fd9d"</span>
</li>
<li>
<span class="prop">status</span>
:
<span class="num">200</span>
</li>
</ul>
</div>
</doctype>
but server response is:
{"session_id":"31446a34db6961a8d67e4e47c96cfb4","status":200}
So, I think that Qooxdoo use response modified by Firefox, not the pure code returned from serwer. In frameworks like jQuery I've had never any problems with that.
Is there any solution for this, or should I add jQuery framework and use jQuery ajax requests?
I have: Qooxdoo 1.2.1 and firefox 3.6.12 under Linux.