0

i have problem with my script i try to use CSRF in my codeigniter and ajax but not working with error 403

this is my HTML :

<?php echo form_open_multipart('dashboard/add_item') ?>
<input type="hidden" id="csrf_test_name" name="<?=$this->security->get_csrf_token_name();?>" value="<?=$this->security->get_csrf_hash();?>" style="display: none">

this is my javascipt :

 $("#propinsi_id").change(function(){           
    var propinsi_id = {propinsi_id:$("#propinsi_id").val()};
    var csrf_test_name = {csrf_test_name:$("input[name=csrf_test_name]").val()};
    $.ajax({
        type: "POST",
        url : "<?php echo site_url('dashboard/select_kota')?>",
        data: {propinsi_id,csrf_test_name},
        success: function(msg){
            $('#kota').html(msg);
        }
    });
});
Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164

0 Answers0