I have been searching for ages but to no avail. I am trying to use jQuery noty in order to give failure notifications (instead of the standard Bootstrap notifications I have been using). I cannot for the life of me get how this is supposed to work. I want the notification to appear based on there being an error in the flashdata...
I am still very much in the learning stages of JavaScript / jQuery so its probably a dumb newbie mistake, I would appreciate any assistance that can be rendered!
Controller:
elseif ($usr_result['status'] == FALSE) {
$this->session->set_flashdata('flashError', 'User not active, please contact your administrator');
redirect('account/login');
}
View:
<?if($this->session->flashdata('flashError')):?>
<script type="text/javascript">
$.noty.defaults.killer = true;
noty({
text: '<?=$this->session->flashdata('flashError')?>',
layout: 'top',
type: 'error',
closeButton: ['true']});
</script>
<?endif?>
I have tested noty with a pressbutton:
<button class="btn btn-primary noty" data-noty-options='{"text":"This is an alert","layout":"top","type":"alert","closeButton":"true"}'><i class="halflings-icon white bell"></i> Bottom Full Width with Close Button</button>
and it works fine (so jQuery and noty are both loaded correctly)