The url is
localhost:23567
The image is similar with
So in the _LoginPartial.cshtml. I have
- <ul class="nav navbar-nav navbar-right">
- <li class="notifications">
- <a href="#">
- <i class="glyphicon glyphicon-globe"></i>
- <span class="badge js-notifications-count hide"></span>
- </a>
- </li>
And in the _Layout.cshtml, I put the script
- <script>
- $(document).ready(function () {
- $.getJSON("/Employee/GetNotifications", function (notifications) {
- if (notifications.length == 0)
- return;
- $(".js-notifications-count")
- .text(notifications.length)
- .removeClass("hide")
- .addClass("animated bounceInDown");
Notice I do have a controller "EmployyeeController.cs".
In the controller, I have the method
- [AcceptVerbs(HttpVerbs.Get)]
- public JsonResult GetNotifications()
- {
- return Json(2, JsonRequestBehavior.AllowGet);
- }
However the number is not showing. The css code
- /* Bootstrap Overrides*/
- .navbar-inverse .notifications {
- position: relative;
- }
- .navbar-inverse .notifications .badge {
- position: absolute;
- top: 8px;
- right: -1px;
- background: #eb1313;
- }
Is the url of $.getJSON wrong?