How can I tell if a request is made with AJAX in Kohana 3?

ajax, kohana, php, xmlhttprequest

Solution

You could also use this:

if (Request::$is_ajax OR $this->request !== Request::instance())
{ .. }

That way you know that it's an ajax- or ajax-like-request

I use this in my controller base-class so I know whether or not to render the full or partial view.

Problem

I've tried these ``` request::is_ajax() Request::instance()->is_ajax ``` To no avail. I've noticed in the `request` class there is a public property `$is_ajax` but I can't seem to be able to access the property. What am I doing wrong?

Original source