I have setup my Codeigniter inside the a sub-folder of my live website eg. www.example.com/project/ci
. When i am trying to load model inside my controller i am getting error of Unable to locate the model you have specified
. I have changed the $config['base_url']
to /project/ci
inside application > config > config.php
.
The template files which we place inside views folder of application folder is working fine but the model is not loading. I have a model of Login
inside application > models > admin > Login.php
.
Here is the code of my controller where i am calling model.
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Home extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('session');
$this->load->helper('form');
$this->load->helper('url');
$this->load->helper('html');
$this->load->database();
}
public function admin_login()
{
$this->load->model('admin/Login');
$result = $this->Login->get_user_details();
print_r($result);
}
}
Here is the code of my model:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Login extends CI_Model
{
function __construct()
{
// Call the Model constructor
parent::__construct();
}
//get the username & password
function get_user_details()
{
echo "coming";
}
}
?>
I am calling function admin_login
with ajax from a view. Here is my script code calling function admin_login
.
var ajaxURL = "<?php echo base_url();?>admin/Home/admin_login/"; //url of controller
jQuery.post(ajaxURL, function(data)
{
alert(data);
});
This code is working fine on xamp. Can anyone help me where i am wrong.