Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing values from client side-scripts to server side-scripts

Status
Not open for further replies.

PanayiotisT

Programmer
Joined
May 31, 2005
Messages
1
Location
GR
Hello there fellow programmers . What I am asking here is simple.I have a server side script and a client-side script.
<%
Dim strtest
strtest = "Value as test"

%>
<script language=VBscript>
Dim strtester
strtester = <%=strtest%>
MsgBox strtester,,"The User Test"
</script>
As you see this is the code if I want to pass the value
from the server variable to the client script.

But what about the opposite?

Can it be done this way ? <%=strtest%> = strtester
or will it be <%strtest%> = strtester

I have some problems there .
Any suggestions?
 
One usual way to pass client side variable value to the server is to submit a form.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You can also use xmlHTTP to comunicate back and forth. Here's a simple example.

Code:
Function MyTest(ByVal strValues)

    Dim sLink, xmlHttp
    Dim sResponseText

    sLink = "//path/YourASPPage.asp"
    set xmlHttp = CreateObject("Msxml2.XMLHTTP.4.0")

    xmlHttp.open "POST", sLink, false
    xmlHttp.setRequestHeader "Content-Type", "application/x-[URL unfurl="true"]www-form-urlencoded"[/URL]

    xmlHttp.send strValues

    sResponseText = xmlHttp.responseText
    
End Function

Here's a simple asp page (YourASPPage.asp) that reads the data posted to it and returns a string back.
Code:
<%@language=VBScript%>
<%
    Dim strPostBuffer   'String posted to this asp page
    strPostBuffer = Request.Form()
    Response.Write "Success"
%>
 

Or yo can post like this
'*****************
Address = "http:"//path/YourASPPage.asp?varName=varValue"
Set ie = CreateObject("internetexplorer.application")
ie.navigate Address
Do Until ie.busy = 0
ie.Visible = False
Loop
ie.Quit
'**********************
sample ASP Page
<%
Site_Id = Request.QueryString("varName")

%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top