[英]Redirect on click to the codeigniter controller
I am trying to redirect a user to a page when he clicks a div. 我在点击div时尝试将用户重定向到页面。 I wanted to know how doI redirect the user to the CI's new controller from the html view?
我想知道如何从html视图将用户重定向到CI的新控制器?
Thank YOu 谢谢
Add the following code in your html view, 在html视图中添加以下代码,
$(function(){
$('#div_id').on('click',function(){
window.location.href = "<?php echo site_url('new_controller'); ?>";
});
});
Do change the div_id
and new_controller
to suit your need. 请更改
div_id
和new_controller
以满足您的需要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.