Getting values from JavaScript to CGI Bin program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rajan Vijayaraghavan

    #1

    Getting values from JavaScript to CGI Bin program

    Hi,
    I have a question with the JavaScript and CGI. This is the
    scenario.
    Say, a user is coming to page 'X'. The page 'X' is completely
    generated by a cgi bin program. The cgi-bin program is in C. The page
    'X' has JavaScript code to set and read cookies. When I generate the
    page 'X', is there a way I can get the cookie value (a counter say)
    into some variable in the Cgi program ? Based on the counter, i want
    to the cgi to display different page. Is this possible ?


    Rajan
  • Martin Honnen

    #2
    Re: Getting values from JavaScript to CGI Bin program



    Rajan Vijayaraghavan wrote:[color=blue]
    > Hi,
    > I have a question with the JavaScript and CGI. This is the
    > scenario.
    > Say, a user is coming to page 'X'. The page 'X' is completely
    > generated by a cgi bin program. The cgi-bin program is in C. The page
    > 'X' has JavaScript code to set and read cookies. When I generate the
    > page 'X', is there a way I can get the cookie value (a counter say)
    > into some variable in the Cgi program ? Based on the counter, i want
    > to the cgi to display different page. Is this possible ?[/color]

    Sequence of actions:
    browser sends HTTP request
    server executes CGI to answer request
    browser receives request and executes client side JavaScript to set
    cookie

    therefore the CGI cannot know the cookies the JavaScript sets later.
    In general cookies are sent as HTTP headers, thus to check for cookies
    you need to find out how your CGI can read HTTP headers. Ask in a group
    about CGI programming

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    Working...