[英]Codeigniter : confirmation message Javascript not show
i was trying to show confirmation message using bootbox
. 我试图使用
bootbox
显示确认消息。 i have download and attach the JS in my header page 我已经下载了JS并将其附加到我的标题页中
<link href="<?php echo base_url('assets/css/bootbox.min.js') ?>" rel="javascript">
then, i have added the following code on controller 然后,我在控制器上添加了以下代码
function index()
{
//This method will have the credentials validation
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="alert alert-danger" role="alert">', '</div>');
$this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|callback_check_database');
if($this->form_validation->run() == FALSE)
{
//Field validation failed. User redirected to login page
$this->load->view('header.php');
$this->load->view('login/content.php');
$this->load->view('footer.php');
}
else
{
//Go to private area
echo "<script language=\"bootbox.min.js\">.bootbox.alert(\"Login Sukses !\");</script>";
redirect('home', 'refresh');
}
} and here's my autoload config 这是我的自动加载配置
$autoload['libraries'] = array('database','session','javascript');
but still the message box is not showing. 但消息框仍未显示。
is there anything else that i should check ? 还有什么我应该检查的吗? or is there anything wrong in my code ?
还是我的代码有什么问题?
update : i have corrected the header page into 更新:我已将标题页更正为
<link href="<?php echo base_url('assets/css/bootbox.min.js') ?>" rel="javascript">
on the redirect page add this to be part of the html code so when it loads up it will show the popup 在重定向页面上,将其添加为html代码的一部分,因此在加载时将显示弹出窗口
<script>
window.onload = function() {
return alert("ERRROR");
}
</script>
and in the else condition 在其他情况下
redirect('home', 'refresh');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.