Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-12-2009, 05:58 AM   PM User | #1
David P.
New to the CF scene

 
Join Date: Mar 2009
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
David P. is an unknown quantity at this point
Calling variables

Not sure if this is possible, can you help?
-made a function_1 that sets the value of a variable
-a different site is calling a function_2 in the same .js script
-need function_2 to call the variable that was set in function_1

-basically I need a function to call a variable that was set in another function

is it possible? how do I do this?
David P. is offline   Reply With Quote
Old 03-12-2009, 06:57 AM   PM User | #2
Eldarrion
Regular Coder

 
Join Date: Feb 2009
Location: Wheeling, IL
Posts: 358
Thanks: 5
Thanked 62 Times in 60 Posts
Eldarrion is on a distinguished road
If I understand you correctly, it shouldn't be. Two different sites interacting via variables in JS would be... for lack of a better word, impossible. (Even with global JS variables, the variables are accessible only by the local site)
Eldarrion is offline   Reply With Quote
Old 03-12-2009, 04:05 PM   PM User | #3
amars1983
New Coder

 
Join Date: Mar 2009
Posts: 22
Thanks: 3
Thanked 0 Times in 0 Posts
amars1983 is an unknown quantity at this point
You could place both functions into one external file, link to it from both pages, and just make the variable in the first function that you want in the second global. Hope this helps.
amars1983 is offline   Reply With Quote
Old 03-12-2009, 04:08 PM   PM User | #4
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
Quote:
Originally Posted by amars1983 View Post
You could place both functions into one external file, link to it from both pages, and just make the variable in the first function that you want in the second global. Hope this helps.
The shared JS file will have two instances of it, the variables can not be shared.

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Reply

Bookmarks

Tags
calling, function, javascript, newbie, variable

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:44 PM.


Advertisement
Log in to turn off these ads.