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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:53:31+00:00 2026-06-05T02:53:31+00:00

I try to manipulate a variable inside a function. But it seems to forget

  • 0

I try to manipulate a variable inside a function. But it seems to forget the values once I exit the function, eventhough the variable is declared outside the function.

The essential code:

var posts = {};                

            // Perform a data request
            // skjutsgruppens-page
            $.oajax({
                url: "https://graph.facebook.com/197214710347172/feed?limit=500",
                    *SNIP*
                    success: function(data) {
                    $.extend(posts, data);
                }
            });


            // Gruppen
            $.oajax({
                url: "https://graph.facebook.com/2388163605/feed?limit=500",
                *snip*
                success: function(data) {
                    $.extend(posts, data);
                }
            });

The oajax retrievies data from facebook. I want to make a variable that contains the data from both oajax methods.

The actual code: http://eco.nolgren.se/demo/resihop/#

  • 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-05T02:53:33+00:00Added an answer on June 5, 2026 at 2:53 am

    The issue is likely that the success function executes at an arbitrary time in the future–unless you specifically access posts after you know the success function has executed, you will receive undefined results, completely dependent on function and access timing.

    The best approach is to handle this correctly by doing necessary work inside in the success function, or use something like jQuery’s .when function.

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

Sidebar

Related Questions

I am attempting to manipulate an asp.net MVC2 view variable in Jquery... (function ()
The problem occurs when i try to manipulate an image uploaded from sinatra. File.open(params[:file][:tempfile])
I'm using Python's minidom library to try and manipulate some XML files. Here is
Sometimes, I need some functor-helper to manipulate list. I try to keep the scope
How to set global variable. $(document).ready(function() { $(a.action).click(function(event) { var tempResponse = ; $.get(,
I try to manipulate the sifr output. I want to add some kind of
It seems everyone is doing this (in code posts etc.)...but I don't know how.
I try to use mmap() to manipulate virtual memory. I want to reserve and
I have some content from server using $.ajax() function. I try to replace some
Try executing the following in JavaScript: parseInt('01'); //equals 1 parseInt('02'); //equals 2 parseInt('03'); //equals

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.