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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    would someone please help solve a Java script parameter problem

    I am trying to pass a variable contents from a Java script into VBscript environment.

    The following code is what I have:

    <script language="Javascript" src="http://gd.geobytes.com/gd?after=-1&variables=GeobytesCountry,GeobytesCity">
    </script>
    <script language="Javascript">
    strcountry=(sGeobytesCountry);
    </script>
    <%Response.write(strcountry)%>

    As you can see, I cannot access variable strcountry.

    Reason been that all client side scripting such as java is executed after the server side.

    I want to know how I can pass that variable to VBscript environment using an alternative way.

    The java script gets the country and city of the clients pc using a URL.

    Thanks
    Last edited by demetries; 02-03-2004 at 01:22 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You need one page that you can serve to the client with the script in it and that page can place the responses into a form (or build a url that passes those responses) and that page can then be posted to the server where you can use those responses to create the next page.

    What you cannot do is create part of a page (or even a whole page) on the server and then get data from the client and create the rest of the page (or a second page) as one run of the server side code. Your server side code will be completely finished executing before the client begins to interact with the web page that came from the server.

    If you want data to persist from one sending of the page to the next for a user then you need to look into data persistance stategies like Session variables or database stores.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Eventhough I don't think its all that good an idea one can use script tags to communicate to and from a server after the page has loaded.


  •  

    Posting Permissions

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