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() {

        //##### UPDATE SEEN COLUMN AFTER CLICK #########
        $("#notifLink").click(function (e) {

            var myData = "1"; //build a post data structure
                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) {
                error:function (xhr, ajaxOptions, thrownError){

        $('#drp-bx').hover( function() {


    function getNewApplicants() {

Route::any('retrieve', function(){
    $app_Notify = Applicant::where('seen', '=', '0')->get();

    return count($app_Notify);

Not sure you should use the same script for your current purpose. Also, how user ends up to the page that you want to show the notification? How do you construct your registered page (form filling)? The Ajax could be used if you do not want to load the whole page again. However, it should NOT BE USED if your real purpose is to redirect to a page (especially from the form) because It is NOT SAFE because it is XSS vulnerable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.