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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:36:31+00:00 2026-05-29T07:36:31+00:00

A global ld object is used throughout my program. It’s contents can be entered

  • 0

A global ld object is used throughout my program. It’s contents can be entered manually, picked up from a server, or read from local storage. The writeload() function uses the ld object, and when the object is picked up from local storage, all is well. I had hoped that the JSON call would use the global storage ld, but it apparently doesn’t. Thus my question is: how to I get the JSON ld object to the global ld object. I’m pretty sure I could perform the writeload() function by duplicating its code inside the JSON call, but it’s long and I’d like to avoid that if possible. All suggestions are welcome as well as any thoughts on a better structure/way of doing things. Many thanks.

switch (oSource.from) {
    case 'server':
        $.getJSON('reports/' + oSource.filename,function(ld) {
            writeload();
        });
        break;
    case 'local':
        ld=$.jStorage.get(oSource.filename);
        writeload();
        break;
}
  • 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-29T07:36:32+00:00Added an answer on May 29, 2026 at 7:36 am

    how about this:

    $.getJSON('reports/' + oSource.filename, function(new_ld) {
        ld = new_ld;
        writeload();
    }); 
    

    when you send a request to your URL (‘reports/’ + oSource.filename), it returns an object, and jQuery that you are using calls your function with this object as a parameter. the parameter is called new_ld inside the function invocation, so you just assign it to your global variable. In your original post, you had your function parameter named ‘ld’ and it effectively hid the global variable with the same name from the scope of the function.

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

Sidebar

Related Questions

Is there any way i can access the page object from within the global.asax
What does 'this' keyword refer to when used in global object? Let's say for
Should I access global db object directly from within the methods of each class?
In classic ASP there is a global object called Application that is accessed simultaniously
I am using the 1.2 version of Uza's Global singleton ( http://www.uza.lt/codex/as3-global-object/ ). The
In my senario, I have a global setting object, say GlobalSettings, it has a
I have a custom security principal object which I set in the global.asax for
I have a recursion function that parses an object/array with a global variable. If
I'm new to object oriented programming and flash. As far as I know, global
I am looking for an alternative to using an object/variable in global scope --

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.