Not getting data from jquery in codeigniter controller

500Getting Error like 500 (Internal Server Error)

jquery-3.6.0.js:10109 POST http://localhost/Banner_module/public/index.php/delete 500 (Internal Server Error)

HTML code:

  • <td><button type="button" value="<?= $row['bid'];?>" class="cd btn btn-outline-danger">Delete</button></td>

jquery Code:

$.ajax({
          type: "POST",
          url: "<?= site_url('delete') ?>",
           data: {"bid": bid}
         })

Routes :

$routes->post('delete','Home::delete');

controller:

public function delete(){

    

$user = new Bmodel();

    //$bid = $this->input->post('uid',true);
    $bid = $this->input->post('bid');
 
    // $data = array(
    //     'uid'  => $this->input->post('uid')
    //     );
    // $uid= json_encode($data);

    $data['user'] = $user->where('bid', $bid)->delete($bid);
   
    $response = ['status'=> "Deleted", 'status_text'=>'Deleted','status_icon'=>'success'];
    return $this->response->setJSON($response);
       }