I tried to input the data and put it into the database , and then redirect it to the front page . but I wanted to give notification to bootstrap notify after the entry database and redirect it to the front page?
This my Controllers
function insert() {
$barcode = $this->input->post('id_barcode');
$imageResource = Zend_Barcode::factory('code128', 'image', array('text'=>$barcode.date("Ymd")), array())->draw();
$imageName = $barcode.'.jpg';
$imagePath = './result/';
if (!is_dir($imagePath)) {
mkdir ($imagePath, 777, TRUE);
}
imagejpeg($imageResource, $imagePath.$imageName);
$this->product_m->insert_produk($imageName);
redirect('admin/product');
}
This script Bootstrap Notify
<script type="text/javascript">
$(document).ready(function(){
$.notify({
icon: 'fa fa-check-circle',
message: "Success <b>Entry Database</b>."
},{
type: 'info',
timer: 4000
});
});
</script>
Controller
redirect('admin/product/success');
View
<?php
$check_success = $this->uri->segment(3);
if($check_success == "success"){
?>
<script type="text/javascript">
$(document).ready(function(){
$.notify({
icon: 'fa fa-check-circle',
message: "Success <b>Entry Database</b>."
},{
type: 'info',
timer: 4000
});
});
</script>
<?php
};
?>