Forum Discussion
HI mfeltscher
As per my knowledge its not possible to set user notification using rest api but it can be achiveable using jquery. I have done the same part. i.e. facebook shows notification on top of the page. I achived it using jquery. Following is the code. Hope it may help you:
;( function( $, undefined )
{
$.fn.UserNotifications = function()
{
var $item = $( '#user-notifications-menu-top' )
, $list = $item.find( '#notification-list' )
, unread = parseInt( $item.find( '.user-navigation-combine-notification-feed .lia-header-nav-component-unread-count' ).text() )
, pageURL = $item.find( '.user-navigation-combine-notification-feed .lia-link-navigation' ).attr( 'href' );
$item.find( '#alerts-count' ).text( unread );
$item.find( '#notifications-page-link' ).attr( 'href', pageURL );
if( unread > 0 )
{
$item.addClass( 'new-notifications' );
$list.find( 'li:lt( ' + unread + ' )' ).addClass( 'unread' );
}
else
{
$item.addClass( 'no-new-notifications' );
}
};
} )( jQuery );
Note: Also you need to make some css per code.
Hi bhupen
Thank you for your reply. Since we want to use the notification count in a third party software we cannot solve this by using Frontend technologies such as Javascript / jQuery.
Thanks anyway for sharing your code
Moreno
Related Content
- 11 years ago
- 11 years ago
- 6 months ago
- 8 months ago