Skip to content

Instantly share code, notes, and snippets.

@loonies
Created January 9, 2012 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loonies/1585180 to your computer and use it in GitHub Desktop.
Save loonies/1585180 to your computer and use it in GitHub Desktop.
/**
* Render notices
*
* Converts a JSON object to the HTML notice
*
* @param json JSON object
* @return string
*/
function notify(data)
{
var output = '';
$.each(data, function (type, notification)
{
output = output + '<div class="' + type + '">';
$.each(notification, function (index, notice)
{
output = output + '<h6>' + ucfirst(notice.type) + '</h6>';
output = output + '<p>' + notice.message + '</p>';
output = output + '<ul>';
$.each(notice.items, function (index, msg)
{
output = output + '<li>' + msg + '</li>';
});
output = output + '</ul>';
});
output = output + '</div>';
});
return output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment