Welcome Guest, Not a member yet? Register   Sign In
Links, Controllers in CodeIgniter
#1

[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.


Messages In This Thread
Links, Controllers in CodeIgniter - by El Forum - 12-16-2013, 03:36 PM
Links, Controllers in CodeIgniter - by El Forum - 12-26-2013, 03:16 PM
Links, Controllers in CodeIgniter - by El Forum - 12-26-2013, 03:26 PM
Links, Controllers in CodeIgniter - by El Forum - 12-28-2013, 05:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB