Hello, I am calling the controller to get the section using AJAX in my encoder based application that has CSRF Enable
my ajax code
$('#classes').change(function(){ $classes=$(this).val(); $.ajax({ type:"POST", data:{ '<?php echo $this->security->get_csrf_token_name(); ?>' : '<?php echo $this->security->get_csrf_hash(); ?>', 'class':$classes }, url:"<?php echo base_url();?>index.php/admin/getsection/"+$classes, success:function(return_data) { //alert(return_data); $('#section').html(''); $('#section').html(return_data); $('#section').val(section); } });
When I first call the ajax function, it will work fine. but when I run the same function again, it will return a 403 forbidden error.
Please advise what I do
source share