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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:49:58+00:00 2026-05-23T19:49:58+00:00

I have global variable fan_coil_ai_bi, and I use that variable to store some data

  • 0

I have global variable fan_coil_ai_bi, and I use that variable to store some data which I get from request, but problem is that len_1 is 1 ( what is ok value in this case ) and len_2 is undefined (what is wrong). How that happen in my function bellow ? How to achieve that len_2 have same value like len_1 ? What is wrong with this code ?

function read_required_fields(fan_coil_id) {
    var parameters = {};

    parameters['command'] = 'read_required_fields';
    parameters['fan_coil_id'] = fan_coil_id;

    $.get("php_scripts/network_script.php", parameters, function(data) {
        fan_coil_ai_bi=data;
        alert('len_1='+fan_coil_ai_bi.length);
    }, "json");
    alert('len_2='+fan_coil_ai_bi.length);
}
  • 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-23T19:50:01+00:00Added an answer on May 23, 2026 at 7:50 pm

    Asynchronous JavaScript and XML is asynchronous.

    The get method means “Make an HTTP get request and when it gets a response, do this”.

    It does not pause execution of the function until the HTTP response arrives.

    If you want to do anything with the data, do it in the callback function (or a function you call from it).

    $.get("php_scripts/network_script.php", parameters, function(data) {
        fan_coil_ai_bi=data;
        alert('len_1='+fan_coil_ai_bi.length);
        alert('len_2='+fan_coil_ai_bi.length);
    }, "json");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a python module that makes use of a huge dictionary global variable,
I have a global JSON variable where I store some parameters and then each
I have some global variables in a Python script. Some functions in that script
I have a javascript function (function1) that checks some global variables (can the user
If i have global variable in A.dll, that depends on global variable in B.dll
I have a global variable that is an instance of my custom class. How
I have a global variable int[] and I want to clear its data and
I have a global variable I called Y_VAL which is initialized to a value
I have a module named module.py, which checks a global variable in context. module.py:
which is the cleanest way to use something like a global variable? Normally, using

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.