GlebM wrote:
> It is working perfectly for me!
> (http://irequestlive.com, register, login, click on "DJ" button. It is a
> simple list that you can edit, it has rails backend.)
>
> You should use PUT for update, POST for create etc
> Also, make sure that when you create request, you specify "POST" as a second
> parameter
> If it still isn't working, post the code here, I'll try to help
>   
Thanks for the pointers. I've also changed the subject, as this problem
is different from the previous subject which has been solved for me
already, thanks to you guys.

However, it ain't the REST syntax/semantics which is the problem here.
I'm getting the right content and status code back to firefox and even
firebug/wireshark confirm them. But, qooxdoo's event Listener for
"failed" event gives me null content or the previous correct login's
content as I've explained previously, instead of the "wrong password"
content I send from rails.

The code is as follows:

> loginButton.addListener("execute", function(e) {
>         var req1 = new qx.io.remote.Request("/user_sessions/test",
> "POST", "text/plain");
>         req1.addListener("completed", function(res){
>           alert("Login completed:" + res.getContent() + " and status
> code is:" + res.getStatusCode());
>           R     =   res;
>         });
>         
>         req1.addListener("timeout", function(fail){
>           alert("Login timed out:" + fail.getContent() + " and status
> code is:" + fail.getStatusCode());
>           R     =   fail;
>         });
>         
>         req1.addListener("failed", function(t){
>           alert("Login failed:" + t.getContent() + " and status code
> is:" + t.getStatusCode());
>           R     =   t;
>         });
>         req1.setParameter("_method","put");
>         req1.send();
>         
>       }, this);
>      
Now, the rails code is:

> def test
>     render :text => "Login failed!!!", :status => 403
>   end
The above method resides in the user_sessions_controller. You can have
it in any controller, but change the url in the qooxdoo request accordingly.

Now, firebug shows the "Login failed!!!" string as the POST result, but
qooxdoo gives me an alert box with content as "null" but status code 403
is shown properly. Hope that explains the problem.

cheers,
skar.

-- 
--
The life so short, the craft so long to learn. 


------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to