Handle authenticated actions using jquery.ajax


    function() {


            function(e,request) {

                if (request.status == 400) {


                    //window.location.href = "/myapp/login";

                    // handle it as you wish






This is called for all you ajax requests and prevents your page from displaying the login screen in ajax requests.

I really don’t see the use of this code, you cannot clear the view getting it out of the DOM using jquery, you should instead of doing that, generate a view which use a different layout and controller without rendering the view and returning from the controller a CJSON object and then, get the object into your frontend.

This is the best approach.