Session and Flash Messages
Table of contents
1. Overview Table of Contents
Session messages provides support for displaying information to the user in a div element styled using Bootstrap alert classes. Examples are shown below:

Figure 1 - Available colors for flash messages
2. Usage Table of Contents
When using with PHP you must first call the addMessage function form the Session class. An example for how to perform this task is shown below:
Session::addMessage('success', 'Contact has been deleted');
The result of performing the action is shown below in Figure 1.

Figure 1 - Alert success message
Note that the user can close each message by clicking on the x button.
This same action can be completed using jQuery. The only difference is a popup message appears at the bottom of the screen with the message and disappears after 5 seconds. An example from where we use this to delete an image is shown below:
function deleteImage(image_id) {
if(confirm("Are you sure? This cannot be undone!")) {
jQuery.ajax({
url : '/admindashboard/deleteImage',
method: "POST",
data : {image_id : image_id},
success: function(resp) {
if(resp.success) {
jQuery('#image_'+resp.model_id).remove();
updateSort();
alertMsg('Image Deleted.');
}
}
});
}
}
The result of calling this function is shown below in Figure 2.

Figure 1 - Alert info message