Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8111081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:58:45+00:00 2026-06-06T01:58:45+00:00

AIM: I would like to set the below function to call every 5 seconds.

  • 0

AIM: I would like to set the below function to call every 5 seconds. Using qtip.

The variable ALARM_POPUP changes every minute via a shellscript which replaces the contents on the variable.

CODE:

    function popupTXT()

         {

              var ALARM_POPUP="Alarm Warning warning ";

              $('#telecom_1').qtip({content:ALARM_POPUP,style: {name: 'dark', tip: 'topLeft'} });

        };

I am using the below to call on a timer.

    setInterval("popupTXT()",5000);

OUTCOME: This will only work when I refresh the browser. Any suggestions would be appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:58:47+00:00Added an answer on June 6, 2026 at 1:58 am

    The variable ALARM_POPUP changes every minute via a shellscript which replaces the contents on the variable.

    That means that in order to see that change on the page, you have to call the server to get an updated value. You’re not doing that.

    You could do that via ajax. Create a server-side page that outputs the new value for ALARM_POPUP as raw text (using Content-Type: text/plain) or as JSON (using Content-Type: application/json), and trigger an ajax call to get the contents of that page, then update the qtip with it. You wouldn’t want setInterval for that because with the indeterminate length of time the ajax call would take, things would very quickly become chaotic. Instead, just initiate a setTimeout upon completion of the previous cycle.

    Assuming you create an updatealarm.xyz page (PHP, JSP, ASP.Net, whatever) that outputs the current ALARM_POPUP value as plain text, that would look something like this:

    (function()
    {
        var ALARM_POPUP="Alarm Warning warning ";
    
        function updateQtip(popupText)
        {
            $('#telecom_1').qtip({content:popupText,style: {name: 'dark', tip: 'topLeft'} });
            setTimeout(nextUpdate, 5000);
        }
    
        function nextUpdate()
        {
            $.ajax({
                url: "updatealarm.xyz",
                success: function(data)
                {
                    ALARM_POPUP = data; // Although you don't actually need to update it
                    updateQtip(data);
                },
                error: function()
                {
                    // Do error handling
                }
            });
        }
    
        updateQtip();
    
    })();
    

    About your original setInterval call: It’s best not to pass strings into setInterval or setTimeout; that’s basically doing an eval, and it’s neither necessary nor a good idea. Instead, pass in a function reference (e.g., the function’s name, without () calling it), as above.


    Re your comment below:

    I am having problems with this and I was wondering if you provide an example of what the php file would look like

    I’ve only done a little PHP, but I believe it would look like this:

    <?php
        header('Content-Type: text/plain');
        echo 'This is the message that will end up in \'data\' in the ajax success handler.';
    ?>
    

    Or if you prefer to use a variable to make it easier for your sed script:

    <?php
        header('Content-Type: text/plain');
        $alarm_popup = 'This is the message that will end up in \'data\' in the ajax success handler.';
        echo $alarm_popup;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The aim I would like to set such size for the DataGrid (standard, from
I would like to test a function with a tuple from a set of
AIM: I would like to tail the last line of the file.txt and input
The aim: I would like a Tumblr blog to pull CSS from a Rails
Is it possible to create types like e.g. String(20) in scala? The aim would
My aim is to create a map function like this map = function ()
I am set to create a file explorer using Java. The aim is to
Well to begin i would like to mention that the aim of this question
I am using Ruby on Rails 3 and I would like to handle user
I would like to check to see if a box is checked using jquery.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.