I have a simple app in codeigniter. In my view I have ajax POST request to the controller, but I don't receive response data. I checked in the chrome dev tool in network tab the response and the message is: No response data available for this request : My view:
    <table class="table table-striped table-bordered">
<thead>
<tr>
<td>First</td>
<td>Sec</td>
<td>Th</td>
<td>Th</td>
</tr>
</thead>
<tbody>
<?php 
if(isset($result))
{
foreach($result as $value)
{
    echo "<tr><td>". $value->cai . "</td><td>". $value->partner ."</td><td>". $value->spot ."</td><td><button type='button' id='".$value->cai."' class='btn btn-danger delete'>Delete</button></td></tr>";
 
}
}
?>
</tbody>
</table>
<?php echo $this->pagination_bootstrap->render(); ?>
<script>
$('.table').on('click','.delete',function(){
    
    var id=$(this).attr('id');
    var confirm_box=confirm('Sure?');
    if(confirm_box === true)
    {
        $.ajax({
        url: '<?php echo site_url('Tires_Crud/deleteCai'); ?>',
        type: 'POST',
        data: {
            key: id
        },
        dataType: 'json',
        success: function(data) {
            console.log(JSON.parse(data));
        }
    });
    
    }
});
</script>
My controller:
    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Tires_Crud extends MY_Controller
{
  
    
    public function deleteCai()
    {
        $status = array(
            "STATUS" => "true"
        );
        return  json_encode($status);
        }
}
In my config file CSRF protection is DISABLED! Because when its enabled the ajax request is not working. Thanks for your help in advance!
 
    