My controller is not returning response to ajax

I have a form in several tabs to store patient data, when i click a button i save the data via ajax, and it will automatically go to the next tab
My problem is, the data can be saved in the database, but it can’t automatically go to the next tab
In the controller I return JSON and it is displayed as an HTML page
can you help me solve this problem

this is my ajax script

$(".formkeluhanutama").submit(function(e) {
            e.preventDefault();
            $.ajax({
                url: "<?= site_url('rekammedis/pengkajian/keperawatan/simpan_keluhan_utama'); ?>",
                type: "post",
                data: $(this).serialize() + '&' + csrfName + '=' + csrfHash,
                dataType: "json",
                beforeSend: function() {
                    $('.btn-next').attr('disabled', true).html('<i class="fas fa-spinner fa-spin"></i>'); // Loading state
                },
                success: function(response) {
                    if (response.sukses) {
                        // Pindah tab ke "Pemeriksaan Fisik"
                        $('#pemeriksaan-fisik-tab').tab('show');
                    } else {
                        // Tampilkan error validasi jika ada
                        if (response.error) {
                            if (response.error.keluhan_utama) {
                                $('#keluhan_utama').addClass('is-invalid');
                                $('.errorKeluhanUtama').html(response.error.keluhan_utama);
                            } else {
                                $('#keluhan_utama').removeClass('is-invalid');
                                $('.errorKeluhanUtama').html('');
                            }
                        }
                    }
                },
                error: function(xhr, ajaxOptions, thrownError) {
                    alert(xhr.status + "n" + xhr.responseText + "n" + thrownError);
                }
            });
            return false
        });

this is my controller

public function simpanKeluhanUtama()
    {
        $validation = ConfigServices::validation();

        $valid = $this->validate([
            'keluhan_utama' => [
                'label' => 'Keluhan Utama',
                'rules' => 'required',
                'errors' => [
                    'required' => '{field} Lengkapi form ini'
                ]
            ]
        ]);

        if (!$valid) {
            // Kalau validasi gagal, bisa redirect balik atau kasih error
            return $this->response->setJSON([
                'error' => [
                    'keluhan_utama' => $validation->getError('keluhan_utama')
                ]
            ]);
        } else {
            $simpandata = [
                'id_kunjungan' => $this->request->getVar('id_kunjungan'),
                'keluhan_utama' => $this->request->getVar('keluhan_utama'),
                'anamnesa' => $this->request->getVar('anamnesa'),
                'riwayat_penyakit' => $this->request->getVar('riwayat_penyakit'),
                'riwayat_alergi' => $this->request->getVar('riwayat_alergi'),
                'riwayat_obat' => $this->request->getVar('riwayat_obat'),
                'id_faktor_resiko' => is_array($this->request->getVar('perilaku_beresiko')) ? implode(',', $this->request->getVar('perilaku_beresiko')) : $this->request->getVar('perilaku_beresiko'),
                'faktor_resiko_lain' => $this->request->getVar('perilaku_beresiko_lain')
            ];

            $keluhanUtama = new AppModelsKeluhanUtamaModel();
            $keluhanUtama->insert($simpandata);

            // Setelah simpan, redirect atau kasih flash message
            log_message('debug', 'Sukses insert keluhan utama');

            return $this->response->setJSON(['sukses' => true]);
        }
    }

the data can be saved to the database, but the return from the controller is JSON “success: true” in the html page, not a view to the next tab
When I try to console.log(response), it doesn’t return any value. can you help me?

I hope that what comes back is the next tab view