you forgot the () after the method names

  $this->RequestHandler->isAjax() 

etc

also, this is deprecated, use

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

etc as documeted


Am Sonntag, 2. Februar 2014 12:16:02 UTC+1 schrieb Sam Clauw:
>
> Allright, that will be much easier to understand the whole AJAX and 
> request happening! Last years, I've realy struggled with this and I think 
> it will be a lot clearer for me now. Thank you!
> To go back on my sorting problem: it isn't working yet. I dugged into 
> CakePHP's Request Handling documentation and tried to catch the POST values 
> from that AJAX request. The strange thing is that my controller seems to 
> haven't catched a request at all! Here's my controller code:
>
> class AttractionsController extends CoasterCmsAppController
> {
>     public $components = array(
>         'RequestHandler'
>     );
> ...
>     public function beforeFilter() {
>         if ($this->RequestHandler->isAjax) {
>             echo 'Ajax';
>         } elseif ($this->RequestHandler->isPost) {
>             echo 'Post';
>         } elseif  ($this->RequestHandler->isGet) {
>             echo 'Get';
>         } else {
>             echo 'Damn, this string shouldn't be here!';
>         }
>     }
> }
>
> As you can guess, I always got the string "Damn, this string shouldn't be 
> here!" outputted (instead of the "Ajax" echo). However, my javascript has 
> no errors and I do get my data when I alert it in the "succeed" of my 
> $.ajax. Is there something crucial that I'm forgetting? :)
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to