Problem loading view

1

Hello, I'm consuming an API in my controller and, upon receiving the result, I'd like to load a view from the user panel. But when the script arrives in the $this->load>view() method nothing happens. I debugged to know if the information is arriving in the controller and if the execution goes into the conditional and the answer is yes, but the view is not loaded. I also tried to give redirect('Controller/Action', 'refresh') but it also did not work, nothing happens. Thanks if anyone can help.

Function that submits to controller:

    $('#form').validate({
    submitHandler: function () {
        $.ajax({
            type: 'GET',
            url: appPath + '/' + controller + '/' + action,
            dataType: 'JSON',
            data: $('#form').serialize(),
            cache: (false),
            async: (false),
            success: function (data) {
                alert(JSON.stringify(data));
            },
            error: function (err) {
                alert.log(err);
                //semanticAlert(err);
            }
        });
    }
});

... / controllers / User.php:

public function autenticar() {
    try {
        $credenciais = $this->input->get();

        $headers = array(
            'xAuthChaveApi: ' . API_KEY,
            'login: ' . $credenciais['login'],
            'senha: ' . $credenciais['senha']
        );

        $response = curlRequest('GET', Enum::authUsuario, $headers);

        if (isset($response['data']) && $response['meta']['status'] == 'success') {
            $this->session->set_userdata($response['data']);

            $dados = array(
                'titulo' => 'Painel de Controle',
                'nomeView' => 'dashboard/home'
            );

            $this->load->view('menu', $dados);
        }
        //echo json_encode($response['meta']);
    } catch (Exception $ex) {
        die($ex->getMessage());
    }
}
    
asked by anonymous 21.09.2017 / 20:56

0 answers