PHP
Codeigniter
Codeigniter Check Request Is Ajax Example
Hi everyone, Sometimes we need to check request is ajax or not in codeigniter 3 application. If you want to call same method but if request is ajax then you perform different, then you can do by using $this->input object.
- TAGS
- PHP
- Codeigniter 3
- Ajax
- 4.5/5.0
- Last updated 05 September, 2022
- By Admin
In Codeigniter 3 $this->input object provide is_ajax_request() method to check request is ajax or not, In following example you can see how it's works.
You can check see bellow controller method example so you can learn how to use is_ajax_request() and determine request is from ajax or not.
Example:
input->is_ajax_request()) { $data = array( 'title' => $this->input->post('title'), 'description' => $this->input->post('description') ); $this->db->insert('items', $data); echo 'Added successfully.'; }else{ echo 'You can not access'; } } ?>
I hope it can help you...
Categories
PHP
(5)
Codeigniter
(5)
Laravel
(3)
JS
(1)
Angular JS
(5)
Node JS
(5)
Vue JS
(4)
React JS
(6)
jQuery
(5)
Javascript
(3)
jQuery UI
(6)
Wordpress
(1)
Python
(5)
Database
(1)
MySql
(5)
Mongo DB
(1)
DBMS
(1)
SQL
(5)
HTML
(1)
HTML 5
(5)
CSS
(5)
Bootstrap
(5)
Ajax
(5)
JAVA
(1)
JSON
(5)
Ubuntu
(5)
Server
(5)
Git
(3)
Google
(1)
Google Map
(7)
Google API
(1)
Elastic Search
(1)
Apache
(1)
Installation
(1)