With Session, for example, at the connexion, you store a value in a session variable like this for example :
PHP Code:
$this->session->set_userdata('key', 'balbla');
In your controller, you send ajax request to avoid to pass variables by url and you send them by POST method.
You control that the session user is again available by controlling the existence of your session variable ($this->session->userdata('key')) defined before.
After you can do everything with session variables.
If you get a variable in your controller like the example before "public function get_first_view($id_user)", think to control the type of the variables. For example, here, if $id_user would be an integer, think to protect and cast the variable like this for example :
[php]
$id_user = (int) $this->security->xss_clean($id_user) ; // cast to integer and secure agaist xs attack
I hope that help you.
Refer to userguide of CI3 or CI2 switch your version.
Have a good day.