Greetings pros,
Can someone give me an idea on how to create a notification like the comments on facebook?
What i have in hand is; The Counter increases when the database updates.
But the counter only updates when the user hovers it.
So What i need to do is.
When someone registers. There would be a notification that will indicate that someone registered to the page.
here's the code that updates the counter on user hover.
$(document).ready(function() {
//RETRIEVE SEEN COUNT
getNewApplicants();
//UPDATE SEEN COLUMN
//##### UPDATE SEEN COLUMN AFTER CLICK #########
$("#notifLink").click(function (e) {
e.preventDefault();
var myData = "1"; //build a post data structure
jQuery.ajax({
type: "POST", // Post / Get method
url: "http://localhost/laravel/public/notified", //Where form data is sent on submission
dataType:"text", // Data type, HTML, json etc.
data:myData, //Form variables
success:function (response) {
console.log('success');
getNewApplicants();
$('#msgnotif').fadeOut();
},
error:function (xhr, ajaxOptions, thrownError){
alert(thrownError);
},
});
});
$('#drp-bx').hover( function() {
getNewApplicants();
});
});
function getNewApplicants() {
$("#notifBadge").load('retrieve');
}
Route::any('retrieve', function(){
$app_Notify = Applicant::where('seen', '=', '0')->get();
return count($app_Notify);
});