Detect AJAX Request in php

sometimes we are use single page for render html and response ajax request, so we need to detect ajax request or page render request.

In this article i would like to explain how to detect ajax request in Core PHP, Codeigniter and Zend framework and process your code.

Detect Ajax Request In Core PHP

This below code catch ajax request and provide event, so you can process your ajax operations.

In above code detect ajax request and you can process your code/operations.

Detect Ajax Request in Codeigniter

If you want use same action for render html and save data in codeigniter you will need to detect ajax request on action and process your code.

Example : Login feature with single action, create login controller

Detect Ajax Request in Zend Framework

If you want use same action for render html and save data in Zend framework, you will need to detect ajax request on action and process your code.

Example : Login feature with single action, create login controller

I hope now you will detect ajax request in your Core PHP, Codeigniter and Zend Framework application and process your code.