[eluser]Unknown[/eluser]
I'm starting with CI and I need some help. I'm trying to load some html pages with Ajax, this html files are stored in view folder, and I'm trying to acess this files using a controller and I have no success until now. I want to know, how I can acess this files and if the controller that i'm using it's correct or there is way better to do it.
Controller
Code:
class Router extends CI_Controller
{
public function index($file)
{
$this->load->view($file);
}
}
Ajax
Code:
var SampleFunction = function (router) {//router is my base_url() + '/router'
var pageContentBody = $('.page-content .page-content-body');
if ($("#startLoadTag")){
$.ajax({
type: "post",
cache: false,
url: router + '/SampleLink.html',
dataType: "html",
success: function (html) {
pageContentBody.html(html);
}
});
}
}
Until now I just get 404 not found.