<a href="javascript:void(0)" onClick="showNotification('Well, it gives this nice, temporary notice at the bottom of the page.')">What does this do, exactly?</a>

<a href="javascript:void(0)" onClick="showNotification('Good for Ajax call completion, but also for notifying the user about a longer task that is being kicked off.')">What for?</a>

<a href="javascript:void(0)" onClick="showNotification('Just put the showNotification function in a common.js file.')">Abstraction is nice.</a>


#ajax_result {
  position: absolute;
  z-index: 1001;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fde073;
  text-align: center;
  line-height: 2.5;
  overflow: hidden;
  -webkit-box-shadow: 0 0 5px black;
  -moz-box-shadow: 0 0 5px black;
  box-shadow: 0 0 5px black;
}

a {
  display: block;
  width: 200px;
  margin: 0 auto;
  padding: 20px;
  background: #dedede;
  border-radius: 10px;
  text-decoration: none;
  color: #333;
  font-family: Arial;
  margin-top: 20px;
}

body {
  background: #333;
}
function showNotification(notifyText) {
    $("body").append($("<div id='ajax_result'></div>"));
    $("#ajax_result").html(notifyText);
    $("#ajax_result").hide();
    $("#ajax_result").slideToggle('slow');
    $("#ajax_result").delay('4000').slideToggle('slow', function() {
        $("#ajax_result").remove();
    });
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js