Jquery utility to display messages in a div - jquery.messageBox.js -

This litte utility is used to display response or error messages from the server, and which can be used to display any message you want.

Examples: (click on buttons below)


Note that the "success" and "warning" messages fade out after 3 seconds, while "info" and "danger" messages will stay diplayed until you close it.

Very simple but usefull!

Bonus

In this file, there are also 3 jquery ajax-events binded:

  • ajaxStart: Send the last ajax error to $.messageBox
  • ajaxStop: Shows a div with id #ajaxLoader (it must be present in your DOM, you can place it where you want, and put anything you want in it - like a spinning icon, some text...)
  • ajaxError: Hides the #ajaxLoader div.