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

  • SEARCH
  • Home
  • 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 5932943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:54:17+00:00 2026-05-22T14:54:17+00:00

I have three functions: get_stat(sess) which takes an argument to send to a php

  • 0

I have three functions:
get_stat(sess) which takes an argument to send to a php script
handlestat() which handles the response of the php script
check_sms(sess_a) which should use setInterval to repeat itself – it relies on a variable disabled_stat to clear the timer

But it’s not working, get_stat(sess) is not fired and it just stalls

var disabled_stat = false;
function get_stat(sess)
{
    if(disabled_stat==false)
    {
        var url = "/sms_check_status.php?param=";
        var title_f = document.getElementById('stat_title');
        var stat_f = document.getElementById('stat_text');
        title_f.innerHTML = ' ';
        stat_f.innerHTML = ' ';

        var myRandom=parseInt(Math.random()*99999999);
        http.open("GET", url + escape(sess) + "&rand=" + myRandom, true);
        http.onreadystatechange = handlestat;
        http.send(null);
    }
}

function handlestat()
{
    var str_out = '';
    var results = '';
    if (http.readyState == 4)
    {
        results = http.responseText.split("~");
        if(results[0]=='1')
        {
            document.getElementById('stat_title').innerHTML = results[1];
            document.getElementById('stat_text').innerHTML = results[2];
            if(results[3]=='1')
            {
                disabled_stat = true;
            }
        }
    }
}

function check_sms(sess_a)
{
    my_inteval = setInterval("get_stat(sess_a)", 1000);
    if(disabled_stat==true)
    {
        clearInterval(my_inteval);
    }
} 
  • 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-05-22T14:54:18+00:00Added an answer on May 22, 2026 at 2:54 pm

    This line:

    my_inteval = setInterval("get_stat(sess_a)", 1000);
    

    won’t work, because it’s using a string expression, which’ll end up evaluated in global scope where the variable sess_a doesn’t exist.

    Instead, use:

    my_inteval = setInterval(function() {
        get_stat(sess_a);
    }, 1000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ColdFusion function foo which takes three args, and the second two
I have a calc function in java script that takes three integer parameters, following
I have three functions which I need in every Django Model: def __unicode__(self): return
I have an iphone app where I call these three functions in appDidFinishLaunching: glMatrixMode(GL_PROJECTION);
I have a simple JavaScript file that has three jQuery $document.ready functions. All three
Is there a firefox plugin which functions as an SVN client? I have checked
I have three functions I map over, I wish to stop evaluation upon catching
I have these three functions inside the same class: public function checkLogin() { if(isset($this->getSessionVal()))
I have 3 function in my class B. These three function have to access
I have three classes that all have a static function called 'create'. I would

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.