Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004

    Unanswered: how to pass a javascript variable to asp and vice versa

    hi again !!!
    can anyone please tell me how to pass an asp variable to javascript...actually the problem i m facing is depending on the value of that flag..i need to display the next asp page....
    for eg..if flag=1 i need to display page1.asp
    and if flag=2, display page2.asp

    how do i do this in asp ??? is there some another way out other than javascripting ???????

  2. #2
    Join Date
    Mar 2003
    Atlanta, GA

    Re: how to pass a javascript variable to asp and vice versa

    JavaScript is client side script, ASP is Server side script. ALL ASP is processed before your page is ever sent to the browser.

    To put an ASP variable into JavaScript, simply add <%=yourvariable%> into the JavaScript wherever you need it to appear. Since the ASP is processes first, your javaScript will have the ASP variable inserted into it before sending the html to your browser.

    Passing a variable from javascript into ASP is by definition an impossible thing, since all the ASP is already processed before the page is rendered. You CAN use javascript to call a new ASP page, passing javascript variables as querystring or form variables.


Posting Permissions

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