views:

342

answers:

2

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?

UPDATE

I ended up getting it to work with Request::$is_ajax

+1  A: 

I ended up getting it to work with Request::$is_ajax

Seems they've gotten rid of the function, and are now relying on a public property.

alex
+1 Good to know!
Jonathan Sampson
+1  A: 

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.

Caspar