Welcome Guest, Not a member yet? Register   Sign In
CSRF AJAX REQUEST 403 Forbidden Error - Help
#1

hello everyone 

Firstly ..
 I know English at a simple level So I'm sorry. Hope you can help me

I compared it with a mistake I could not solve



I want to do city {turkish = sehir} when the SelectBox changes, loading the bins into the other {ilcee} SelectBox


I am using Jquery Version = jquery-3.1.1.min.js

and application->config->config.php


$config['csrf_protection'] = TRUE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();


in this way..




and ajax request 

Ajax request script I am also doing view.php so I use javascript between php tags

---------------
echo '
       $(".sehir").change(function()
            {
              
       
           var key = "'.$this->security->get_csrf_hash().'";
           var name = "'.$this->security->get_csrf_token_name().'";
               $.post("'.base_url('basvur/ilcedoldur').'",{name:key,il:$(".sehir").val()},function(output)
               {

                $(".ilcee option").remove();
                $(".ilcee").append(output);

              });


              });

  });
';


and

POST http://localhost/ajans/basvur/ilcedoldur 403 (Forbidden)
 XHR failed loading: POST "http://localhost/ajans/basvur/ilcedoldur".


can't solve help me please


also ilcedoldur.php

 public function ilcedoldur()
    {

        if (isset($_POST)) {
                 $this->load->model("il_model");
                if (isset($_POST["il"])) 
                {
                   $this->il_model->ilce($_POST["il"]);
                }
        }
       
    }
Reply




Theme © iAndrew 2016 - Forum software by © MyBB