foreach ($this->showonline as $key => $friend) {
  • $friend['avatar']; $friend['name'];
  • }" />
      foreach ($this->showonline as $key => $friend) {
    • $friend['avatar']; $friend['name'];
    • }" />
        foreach ($this->showonline as $key => $friend) {
      • $friend['avatar']; $friend['name'];
      • }"/>

        TechQA.

        auto update online user list when new userlogin

        334 views Asked by Bhashana Ranathunga At 2014-11-12T17:10:14+00:00 12 November 2014 at 17:10 2025-12-22T23:01:38+00:00
        <?php        
        <div class="someclass">
            <ul class="someclass">
                foreach ($this->showonline as $key => $friend) {
                <li>
                    $friend['avatar'];
                    $friend['name'];
                </li>
                }
        
            </ul>
        </div>
        ?>
        

        exmple :-

        1. model.php
        2. class.php
        3. hook.php
        4. index.phtml

        with model i get database information. with class im calculating online friend list as a array using array_intersect. and with hook i render to index.phtml. in phtml i use foreach loop and get the result to my online friendlist.

        Here is my function im getting online user list with this. but if new user come to online i must refresh the page to see new online member. i want to make it auto update list. with ajax or something. can someone give me example how can i do that?

        php jquery ajax livechat
        Original Q&A
        2

        There are 2 answers

        1
        Ashique C M Ashique C M On 2014-11-12T17:29:06+00:00 12 November 2014 at 17:29 BEST ANSWER

        You may use setTimeout function, either to reload the page or to call ajax and update the page content. here is small idea.

        setTimeout(function(){
        // Do code here for reload/ajax here.
        }, 3000);
        
        0
        Zz'Rot Zz'Rot On 2014-11-12T17:15:11+00:00 12 November 2014 at 17:15

        I believe the problem is more involved than merely front-end.

        You will need the client to establish a socket with your server such that your server is able to constantly inform users of new online users. Otherwise, using a stay-alive connection with the server can also help, and use some jQuery to handle user list updates.

        Related Questions in PHP

        • How to add the dynamic new rows from my registration form in my database?
        • Issue in payment form gateway
        • How to create a facet for WP gridbuilder that displays both parent and child custom fields?
        • Function in anonymous Laravel Blade component
        • How to change woocomerce or full wordpress currency with value from USD to AUD
        • General questions about creating a custom theme Moodle CMS
        • How to add logging to an abstract class in php
        • error 500 on IIS FastCGI but no clue despite multiple error loggings activated
        • Composer installation fails and reverts ./composer.json and ./composer.lock to original content
        • How to isolate PHP apps from each other on a local machine(Windows or Linux)?
        • Laravel: Using belongsToMany relationship with MongoDB
        • window.location.href redirects but is causing problems on the webpage
        • Key provided is shorter than 256 bits, only 64 bits provided
        • Laravel's whereBetween method not working with two timestamps
        • Implementing UUID as primary key in Laravel intermediate table

        Related Questions in JQUERY

        • In Datatables, start value resets to 0, when column sorting
        • Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
        • window.location.href redirects but is causing problems on the webpage
        • Using JQuery Date Slider
        • Storing selected language in localStorage
        • How to stop other divs from still showing when i click a different button?
        • Check multiple values with jQuery
        • Bootstrap component does not want to render in Datatables function
        • put white spaces when entering an amount moneytype symfony
        • Trouble accessing custom header in AJAX response using jQuery in Fiware Keyrock
        • I just cant make it work, HTML, JS and Firebase error
        • Didn't declared variable still not getting any error in JavaScript
        • Move element horizontally while scrolling vertically in pure JavaScript
        • allow multi carousel in same page
        • Embedded TikTok posts / thumbnail styling issue

        Related Questions in AJAX

        • window.location.href redirects but is causing problems on the webpage
        • Js variable to php using ajax
        • TypeError: Failed to execute 'arrayBuffer' on 'Blob': Illegal invocation - Insert blob into database
        • how do I change a URL with form to include additional selection
        • why i have to put extra space in before write option selected because it show error if i don't ' option:selected'
        • Opening modal through Update button with specified ID using ajax
        • Events disappear randomly for full calendar module
        • Ajax call reloads page in FrontAccounting, a PHP ERP solution
        • Add newly added record to select2 element
        • AJAX query cascading dropdown in django
        • Failed to load resource: the server responded with a status of 403 () - SCRIPT - WordPress
        • Maintaining search and sort state across paginated results in web application
        • Getting POST 500 Internal server error while sending request via ajax call
        • Wordpress server side datatable filtering
        • Having a problem in datatables and fullcalendar scripts

        Related Questions in LIVECHAT

        • Odoo v16 not showing new messages
        • Integrate LiveChat button with Nuxt3
        • I am not able to capture the Emitted message in Flask SocketIo
        • Change the icon of LiveChat Inc Widget when using the library for Reactjs
        • not knowing how to open a react & firebase website that I created
        • Salesforce Embedded Service Web Chat not connecting to agents
        • Not found error on laravel private server echo
        • Is there any library out there that supports p2p live chat in react-native?
        • Uncaught ReferenceError: Livewire is not defined
        • Django Channels: Mission Positional Arguments send and receive
        • JSON Formatting using Snowflake SQL to structure per Date
        • How to embed YouTube live chat with super chat/stickers option enabled?
        • How do I integrate messenger chat plugin in react?
        • Odoo v15 LiveChat App will not load properly
        • StompJS Timeout on watchForReceipt() method

        Popular Questions

        • How do I undo the most recent local commits in Git?
        • How can I remove a specific item from an array in JavaScript?
        • How do I delete a Git branch locally and remotely?
        • Find all files containing a specific text (string) on Linux?
        • How do I revert a Git repository to a previous commit?
        • How do I create an HTML button that acts like a link?
        • How do I check out a remote Git branch?
        • How do I force "git pull" to overwrite local files?
        • How do I list all files of a directory?
        • How to check whether a string contains a substring in JavaScript?
        • How do I redirect to another webpage?
        • How can I iterate over rows in a Pandas DataFrame?
        • How do I convert a String to an int in Java?
        • Does Python have a string 'contains' substring method?
        • How do I check if a string contains a specific word?

        Trending Questions

        • UIImageView Frame Doesn't Reflect Constraints
        • Is it possible to use adb commands to click on a view by finding its ID?
        • How to create a new web character symbol recognizable by html/javascript?
        • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
        • Heap Gives Page Fault
        • Connect ffmpeg to Visual Studio 2008
        • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
        • How to avoid default initialization of objects in std::vector?
        • second argument of the command line arguments in a format other than char** argv or char* argv[]
        • How to improve efficiency of algorithm which generates next lexicographic permutation?
        • Navigating to the another actvity app getting crash in android
        • How to read the particular message format in android and store in sqlite database?
        • Resetting inventory status after order is cancelled
        • Efficiently compute powers of X in SSE/AVX
        • Insert into an external database using ajax and php : POST 500 (Internal Server Error)
        • Privacy
        • Terms
        • Cookies
        • Homegardensmart
        • Math
        • Aftereffectstemplates