How do i auto refresh page using ajax

Hi there, i am new to Yii and love the platform. I am currectly in HumHub social platform which is developed in Yii. In that i am trying to make a chat. So, i am currently trying to convert the wall module_core into chat. I am facing a problem with refreshing the data as update automatically using ajax. The same thing happening with the notification system.

the div which showing the data is :


<div class="s2_streamContent"></div>

I also found the notification code from notification/widget/views/list.php




    // load number of new notifications at page loading

        getNotifications();


        // load number of new notifications in a loop

        setInterval(getNotifications, 60000);




        // load and show new count of notifications

        function getNotifications() {


            var $newNotifications = parseInt(0);


            // load data

            jQuery.getJSON("<?php echo $this->createUrl('//dashboard/dashboard/GetFrontEndInfo'); ?>", function (json) {


                // save numbers to variables

                $newNotifications = parseInt(json.newNotifications);


                // show or hide the badge for new notifications

                if ($newNotifications == 0) {

	                document.title = originalTitle;

                    $('#badge-notifications').css('display', 'none');

                    $('#mark-seen-link').css('display', 'none');

                    $('#icon-notifications .fa').removeClass("animated swing");

                } else {


	                document.title = '('+$newNotifications+') '+originalTitle;

                    $('#badge-notifications').empty();

                    $('#badge-notifications').append($newNotifications);

                    $('#mark-seen-link').css('display', 'inline');

                    $('#badge-notifications').fadeIn('fast');

                    $('#icon-notifications .fa').addClass("animated swing");

                }


            })


        }






I guess the above code is refreshing the notification system to get if any new notification is added. What i am trying to do is trying to refresh the wall posts updates in a page just like the notification so whenever a new messages added or even several it will update it. example : ajax chat

Hope someone will able to help me out of this situation.

I hope i am able to make you guys understand, if not please let me know :)

Cheers

What exactly is the problem you are running into? I don’t think you explained that. If notifications work, what is stopping you from doing the same thing to refresh your wall posts?