/    Sign up×
Community /Pin to ProfileBookmark

how to store global array for different pages

I have a few arrays whose elements are loaded from the server side. Multiple pages will need access these arrays? What would be a good way to store these arrays? (without reload array elements again for each page onload)

thanks

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@mjdamatoNov 07.2006 — When you say the arrays are loaded from the server-side I am assuming you are creating the arrays using some sort of server-side scripting and that you are wanting to use these arrays client-side. If this is correct then one way to access the arrays dynamically on the client side is to use a regular JAVASCRIPT tag with a SRC attribute and an ID attribute.

<script language="javascript" src="array1.js" id="jsArray"></script>

You can then dynamically change the array on the client side using something like this:

getElementById('jsArray).src = 'array2.js';
Copy linkTweet thisAlerts:
@scorpioyauthorNov 07.2006 — thanks mjdamato, but I dont wanna dynamically JS files, I juse wanna access arrays from different pages without loading elements of the array everytime a page is onloaded. Is there such way?
Copy linkTweet thisAlerts:
@scorpioyauthorNov 08.2006 — can someone please help, thanks
Copy linkTweet thisAlerts:
@mjdamatoNov 08.2006 — You need to provide some sort of example or something, becuse your question isn't making sense. Are you saying you want to have two different browser windows open and access arrays from one window in another?
×

Success!

Help @scorpioy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...