Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Re: Pass variable to ASP script from javascript


Message #1 by "Alexander Gray" <alex.gray@n...> on Fri, 1 Mar 2002 16:26:13
Since HTTP is a stateless protocol, the server does not know anything 
about previous requests. Passing values to the server therefore has to be 
done via state management mechanisms.

Common ways to maintain state are:

*Querystring:

javascript:
  document.location.href = "/root/somefile.asp?Variable=" + JSvar
vbscript in /root/somefile.asp:
  VBSvar = Request.Querystring("Variable")

*Or a hidden form-field (POST):

javascript:
  document.form.action = "/root/somefile.asp"
  document.form.hiddenformfield.value = JSvar
  document.form.submit()
vbscript in /root/somefile.asp:
  VBSvar = Request.Form("hiddenformfield")

  Return to Index