Javascript in Response.Redirect?

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

    Javascript in Response.Redirect?

    I hate javascript looking for help.

    I am trying to pass hidden fields around without showing a query
    string in the address bar.

    e.g. formA.asp
    not formA.asp?var1= blah&var2=blah

    I have this going okay so far using forms, hidden fields, and
    javascript hyperlinks on most pages.

    I have a processing page that currently adds records to a database
    then uses the response.redire ct method to pass the results to another
    page (showing the added records).

    e.g.

    Response.Redire ct "formA.asp?var1 =blah&var2=blah "

    I want to hide those variables, is there a way that I can submit a
    form on the response.redire ct or before then, when the records get
    added to the database?

    e.g.
    <%
    'Records get added to db

    Response.Redire ct "javascript:doc ument.form.subm it();"

    %>

    <FORM NAME="form" ACTION="formA.a sp" METHOD="post">
    <INPUT TYPE="hidden" NAME="Var1" VALUE="<%=Blah% >">
    <INPUT TYPE="hidden" NAME="Var2" VALUE="<%=Blah% >">
    </FORM>

    Thanks in advance.

    ~E
  • Evertjan.

    #2
    Re: Javascript in Response.Redire ct?

    Ryann wrote on 02 nov 2004 in microsoft.publi c.inetserver.as p.general:
    [color=blue]
    > e.g.
    > <%
    > 'Records get added to db
    >
    > Response.Redire ct "javascript:doc ument.form.subm it();"
    >
    > %>
    >
    > <FORM NAME="form" ACTION="formA.a sp" METHOD="post">
    > <INPUT TYPE="hidden" NAME="Var1" VALUE="<%=Blah% >">
    > <INPUT TYPE="hidden" NAME="Var2" VALUE="<%=Blah% >">
    > </FORM>
    >
    >[/color]

    The above code is nonsense.

    Please try to understand that both vbscript and jscript ASP run on the
    server BEFORE any code on the client [read: browser] runs.

    IF(!) you redirect to the same server/domain,
    AND IF the client accepts session/ram cookies,
    use session variables.

    example in ASP vbscript [could also be done in jscript]:

    <%
    'Records get added to db

    Session("Var1") = Blah1
    Session("Var2") = Blah2
    Response.Redire ct "formA.asp"
    %>

    =============== ==
    And in FormA.asp:
    =============== ==

    <%
    Blah1 = Session("Var1")
    Blah2 = Session("Var2")

    ' Blah-content is still kept secret from client eyes
    %>

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress,
    but let us keep the discussions in the newsgroup)

    Comment

    Working...