我是codeigniter的新手,无法让我的ajax工作.
我试图在点击时将链接内容加载到主文档中.
我寻找指示,但无法弄清楚.除ajax之外的所有工作都会返回alert(‘ERROR’)消息.没有任何内容加载到< div id ='load_here'>< / div>
也许我在config.PHP中遗漏了一些东西?我必须加载一些库才能使用吗?
任何想法都会有所帮助
//主要文件链接
Link
//控制器
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');}
});
});
});
我认为问题是ajax url不能访问控制器.
Z:/ home / codeigniter / www / register / test这是我觉得它需要我的地方