Yii Framework Forum: Handle authenticated actions using jquery.ajax - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Handle authenticated actions using jquery.ajax Rate Topic: -----

#1 User is offline   pcs2112 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 31-July 10

Posted 15 August 2011 - 04:07 PM

$(document).ready(
    function() {
        $("body").ajaxError(
            function(e,request) {
                if (request.status == 400) {
                    //window.location.reload();
                    //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.
0

#2 User is offline   hackerunet 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 21-November 11

Posted 23 November 2011 - 06:16 PM

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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users