is_ajax_request() public method

Test to see if a request contains the HTTP_X_REQUESTED_WITH header.
public is_ajax_request ( ) : boolean
return boolean
Example #1
0
 private function processResponseData(array $response)
 {
     if (!$this->input->is_ajax_request()) {
         redirect('/');
     }
     $this->output->set_content_type('application/json');
     if ($response['code'] == 200) {
         if ($response['data']['success']) {
             $this->output->set_output(json_encode($response['data']['data']));
         }
     }
 }
 public function ajax($function)
 {
     if (!$this->input->is_ajax_request() || !method_exists($this, $function)) {
         show_404();
         return false;
     }
     $this->{$function}();
     return true;
 }
Example #3
0
require_once BASEPATH . 'core/Input.php';
$local_input = new CI_Input();
if ($local_input->is_cli_request()) {
    ?>

<?php 
    echo strip_tags($heading) . "\n";
    ?>
--------------------
<?php 
    echo strip_tags($message);
    ?>

<?php 
} else {
    if (!$local_input->is_ajax_request()) {
        ?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>404 Page Not Found</title>
<meta charset="utf-8" />
<?php 
    }
    ?>
<style type="text/css">

#container::selection{ background-color: #E13300; color: white; }
#container::moz-selection{ background-color: #E13300; color: white; }
#container::webkit-selection{ background-color: #E13300; color: white; }