[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1411
  • Last Modified:

set server side vbscript variable from client side javascript?

I have a variable I have set using client side javascript ..

when I open another window, is there any way I can set a server side vbscript variable from that javascript variable?

i'm using iframes when i load the asp pages, so i could access that variable in javascript like this:

window.parent.parent.myVariable

but can I somehow take that variable and assign it to a vbscript variable?

Thanks,

0
SeanGraflund
Asked:
SeanGraflund
1 Solution
 
Göran AnderssonCommented:
There is basically two ways of sending values from the client side to the server side, either in the query string, or in a form.

Query string:

---javascript on first page---
var value=42;
window.open('Page2.asp?Param='+value,'_blank');

---Page2.asp---
<%
Value=Request.Querystring("Param")
%>

Form:

---first page---
<form name="TestForm" action="Page2.asp">
<input type="hidden" name="HiddenField" value="">
</form>
<script>
value=42;
document.TestForm.HiddenField.value=value;
document.TestForm.submit();
</script>

---Page2.asp--
<%
Value=Request.Form("HiddenField")
%>
0
 
SeanGraflundAuthor Commented:
well, i understand how those two work, but it didn't provide the results i wanted ..

there is a 3rd option for passing variables from javascript to vbscript ... cookies.  i used that.

thanks,

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now