Code snippets for symfony 1.x

Navigation

Refine Tags

Snippets tagged "http ajax"

Detect an Ajax request

A simple way to detect an ajax request.

In your action class.

$this->isAjaxCall = $this->getRequest()->isXmlHttpRequest();
 

I put the above line in my preExecute where needed, this way the variable is accessible by action and views.

Inside a template you can use the following as well:

$sf_request->isXmlHttpRequest()
 
by Fuad Arafa on 2006-10-27, tagged ajax  http  request 
(2 comments)