I am new to codeigniter and can't get my ajax to work.
I am trying to make links load content into the main document when clicked.
I was looking for instructions, but could not understand. All jobs except ajax return a message alert('ERROR'). nothing loads in <div id='load_here'></div>
Maybe something is missing for me in config.php? Do I need to download a library for this? Any ideas would be helpful // link to main document
<span id='reg_link_rules'>Link</span>
<div id='load_here'></div>
//controller
class Register extends CI_Controller {
public function hello()
{
echo 'hello';
}
}
// jQuery
$(document).ready(function() {
$('#reg_link_rules').click(function(eve){
$.ajax({
type: "GET",
url: "register/hello",
complete: function(data){
$('#load_here').html(data);
},
error: function(){alert('error');}
});
});
});
I think the problem is that the ajax url does not have access to the controller. Z: / home / codeigniter / www / register / test is where I think it takes me
the problem is resolved, the URL must be http: //codeigniter/index.php/register/hello