Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to check an Ajax request in Cakephp?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 270
    Comment on it

    How to check an Ajax request:

    I am writing this blog specially for beginners who are learning Cakephp. In order to check whether the request is through Ajax or not. This can be checked by enabling the RequestHandler component in AppController or enable this on the Controller where you are using it. Type this code to enable RequestHandler:

     

    var $components = array('RequestHandler');

    If its Cakephp 1.3.x, then you check if its an ajax request in your controllers with:

    $this->RequestHandler->isAjax()

    and in Cakephp 2.x:

    $this->request->is('ajax');

    Thats all!

     

    Thanks for reading the blog.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: