Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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?

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    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)

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    22
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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.

  • #4
    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
    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]


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •