Last active
June 26, 2018 23:31
-
-
Save levelone/7941d53bb1793d1c8251df5dd4ed742a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
// ... | |
}).fail(function(response){ | |
window.Flash(response.message, 'error', $('.some-class-container')) | |
}) | |
// ..helpers/flash_helpers.js | |
window.Flash = function (message, type, $container) { | |
$container = ($container == null) ? $('.container-fluid.container-page') : $container | |
var html = | |
'<div class="alert alert-flash alert-' + type + '">' + | |
'<button class="close" data-dismiss="alert" type="button">×</button>' + | |
'<div id="flash_alert">' + | |
'<i class="icon-thumbs-down"></i>' + | |
message + | |
'</div>' + | |
'</div>' | |
return $container.prepend(html); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment