I got some problem here, please help me if you can solve this
so, I use CodeIgniter Framework to create a website I want to use 1 controller for 2 view, but for the second view i got the error from the javascript
this is my controller
public function __construct()
{
parent::__construct();
$this->load->model('M_registration');
}
public function index(){
$this->load->view('templates/V_header');
$this->load->view('en-us/V_home');
$this->load->view('templates/V_footer');
}
public function registration(){
$x['prov'] = $this->M_registration->get_prov();
$this->load->view('templates/V_header');
$this->load->view('en-us/V_registration', $x);
$this->load->view('templates/V_footer');
}
and for the javascript, I use another file named :java_script.php and I called the file from V_footer.php
I use this for called the javascript in the footer
<?php include 'java_script.php'?>
</body>
</html>
then what I want to do here is : I want to go to the registration page from 1 controller example : localhost/myWebsite (this is the home view/index) -> this will called the function index then I want to the registration page from this controller : localhost/myWebsite/registration
this is my javascript in java_script.php
<script src="<?= base_url('assets/')?>js/bootstrap.min.js"></script>
<script src="<?= base_url('assets/')?>js/jquery.validate.min.js"></script>
<script src="<?= base_url('assets/')?>js/main.js"></script>
<script>
$(document).ready(function(){
alert('registration page');
});
</script>
this javascript is working in index, but not working in registration
I already apply .htaccess like this :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
is there any solution for me ? Thank you before.
maybe this can help you to understand my problem here. when I use registration function in new controller, the javascript is working but when I use the function in one controller, the javascript is not working