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 7995837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:32:21+00:00 2026-06-04T14:32:21+00:00

This code load the content of the php file with the parameter: online and

  • 0

This code load the content of the php file with the parameter: online and name and print them dynamic every 0.2s, the whole code works, but it says that ” stats ” is not defined in internet explore, i dont know why. Help me out guys

function updateStats(stat)
{
    var stat = ["online","name"];


   var stats = "";


 if (stat==undefined)
{
document.write("is undefined");
}
    var url = "online.php";

    $.each(stat, function(i, key){
       $.post(url, {stats: key}, function(data) { 
          $("#" + key).html(data);       
       });
    });
} 

setInterval('updateStats("updateStats")', 200); //  200 milliseconds = 0.2 seconds

this is the updated code, but still says that stats not defined

function updateStats(stat)
{


var stat = ["online","money"];


if (typeof stat == "undefined")
{
document.write("stat is undefined");
}
    var url = "online.php";

    $.each(stat, function(i, key){
       $.post(url, {stats: key}, function(data) { // stats to stat
          $("#" + key).html(data);       
       });
    });
} 


setInterval(function(){
  updateStats("updateStats");
}, 1000);


if (typeof stats == "undefined")
{
document.write("stats is undefined");
}
  • 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-04T14:32:25+00:00Added an answer on June 4, 2026 at 2:32 pm

    Change:

    setInterval('updateStats("updateStats")', 200);
    

    To:

    setInterval(function(){
      updateStats("updateStats");
    }, 200);
    

    Also to check if something is undefined, instead of:

    if (stat==undefined)
    

    Use:

    if (typeof stat == "undefined")
    

    Also as pointed out by @Felix Kling, you are passing stat variable via function:

    updateStats(stat)
    

    And also creating it later on inside that function:

    var stat = ["online","name"];
    

    which is weird, you should modify your code to account for that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code to load icon and application name , but it is
i have this simple code to load data from other php page using get
This code works anywhere else.. form load, button click, etc. But when I add
I have this code: <div id=gll_select> <script> var caffe = $(#caffe).val(); $(#gll_select).load(<?php echo base_url()
I use this code to load the content from a different page into the
I'm using this code on top of my PHP file for loading cached files
I'm attemping to use this code to call a php file, access the database,
I use this code to load a .Net assembly to PowerShell: [System.Reflection.Assembly]::Load(System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
This code: $(#permalink a).click(function(id){ var id = this.getAttribute('href'); $(#newPostContent).load(id, function() { $(#removeTrigger).click(function() { $(#removeThis).hideToggle();
I have got this code: XDocument xdoc = XDocument.Load(URI); XElement root = xdoc.Element(forecast); //get

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.