i am using $.post() to call a controllers function from view(though i know its bad practice) and in that function i am loading a view and its not working.
this is HTML code : <li id='files' class="active" >My Files</a></li>
this is JS Code :
$("#files").click(function()
{
alert('hi2'); //just for checking
var loadUrl = "/Fast-Docs/index.php/Docs/updatefiles";
$.post(
loadUrl,
{un:"<?php echo $username?>"});
});
this is function in controller:
public function updatefiles()
{
$this->load->model('DocsModel');
$un=$this->input->post('un');
$files=$this->DocsModel->getAllFiles($un);
$data['files']=$files;
$this->load->view('files',$data);
}
You need to actually display your code after the ajax call, ie
Becomes