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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:22:04+00:00 2026-05-27T21:22:04+00:00

The function down here get’s called every second, it only never outputs: console.log(noise: +noise);

  • 0

The function down here get’s called every second,
it only never outputs:
console.log(“noise: “+noise);

So something goes wrong and i have no idea what or how to figure it out.

function readEye() {
    console.log("readEye");

    $.getJSON('output.json', function(data){
        faceDetected = data.faceDetected;
        frameCount = data.frameCount;
        noise = data.noise;
        console.log("noise: "+noise);
    });

    // show values in devPanel
    document.getElementById('faceDetected').innerHTML = "faceDetected: "+faceDetected;

}
  • 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-27T21:22:05+00:00Added an answer on May 27, 2026 at 9:22 pm

    You stumbled upon the “asynchronous trap”. $.getJSON() does NOT stop the normal program flow and will NOT wait until finished. So the following line document.getElementById('faceDetected').innerHTML = "faceDetected: "+faceDetected; will be called IMMEDIATELY with an undefined “faceDetected” variable. And this will happen every second, no matter if any of the previous requests ever finishes ….

    Generally speaking you should only start a new timeout from inside the callback of an AJAX request. Additionally you should only work with those variables like “faceDetected” or “noise” inside the callback. So if you want to assign those values to a DOM element you should do it INSIDE the callback.

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

Sidebar

Related Questions

I would like to activate a .mouseover function only if the mouse lays down
I am implementing a simple drop-down using hiccup: ;DATASET/CREATE (defn get-cols-nms [table] This function
I'm trying to get the basics down here of class definition and using a
Can someone break down what's going on here clearly? function timerCheck() { for(var i=0;
I am trying to round down a number using PHP's round() function. Here is
A very stripped down example here . Code: function changeBackground() { var testDiv =
var UI$Contract$ddlForm_change = function() { //'this' is currently the drop down that fires the
Is there an easy way to chase down table/stored procedure/function dependencies in SQL Server
I often want to make a multiline function call and reduce it down to
I need to implement a function for moving records up and down (sorting) and

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.