Post Data with Javascript and without using a form tag.

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

    Post Data with Javascript and without using a form tag.

    can anybody help me in writing a javascript function which opens a
    popup window with the target URL when the link "POST Request" is
    clicked..

    Points to note:

    The HTML DOESNT and SHOULDNT HAVE A FORM TAG.
    The URL data should be sent as POST and not GET..i.e the search
    parameters should not be showin in the address bar when the page is
    opened.


    Sample code is:

    <script language="JavaS cript">
    <!--

    function Openlink(url, args)
    {
    /////////////FILL CODE HERE...
    }

    // -->
    </script>
    <!-- *************** *** Change nothing below here ************** -->

    <body>
    <a href="#wf" onClick="JavaSc ript:LinkOpener ('http://www.ntis.gov/search/results.asp?loc =3-0-0&search=','frm _qry_Category=A LL&frm_qry_Sear ch=earth&frm_qr y_Search=AND&fr m_qry_Search=&f rm_qry_Search=A ND&frm_qry_Sear ch=&frm_qry_Yea r=1990&frm_qry_ MaxRec=100&frm_ qry_Rank=1')">P OST
    request</a>
    </body>
    </html>

    Thanks.
  • Csaba2000

    #2
    Re: Post Data with Javascript and without using a form tag.

    One thing you could do is to have a dummy form,
    and when you click on your desired link it fills in
    the desired hidden fields and submits the form.

    Oops, I see that you have the field (element) names
    contained in the query. OK, you can just generate
    those hidden INPUT elements yourself and then
    fill in their values.

    Good luck,
    Csaba Gabor from New York

    "Neo" <niftyhawk@yaho o.com> wrote in message news:869d45b0.0 309151609.233fb 16@posting.goog le.com...[color=blue]
    > can anybody help me in writing a javascript function which opens a
    > popup window with the target URL when the link "POST Request" is
    > clicked..
    >
    > Points to note:
    >
    > The HTML DOESNT and SHOULDNT HAVE A FORM TAG.
    > The URL data should be sent as POST and not GET..i.e the search
    > parameters should not be showin in the address bar when the page is
    > opened.
    >
    >
    > Sample code is:
    >
    > <script language="JavaS cript">
    > <!--
    >
    > function Openlink(url, args)
    > {
    > /////////////FILL CODE HERE...
    > }
    >
    > // -->
    > </script>
    > <!-- *************** *** Change nothing below here ************** -->
    >
    > <body>
    > <a href="#wf"[/color]
    onClick="JavaSc ript:LinkOpener ('http://www.ntis.gov/search/results.asp?loc =3-0-0&search=','frm _qry_Category=A LL&frm_q
    ry_Search=earth &frm_qry_Search =AND&frm_qry_Se arch=&frm_qry_S earch=AND&frm_q ry_Search=&frm_ qry_Year=1990&f rm_qry_MaxRe
    c=100&frm_qry_R ank=1')">POST[color=blue]
    > request</a>
    > </body>
    > </html>
    >
    > Thanks.[/color]


    Comment

    • Neo

      #3
      Re: Post Data with Javascript and without using a form tag.

      Hi there,
      Thanks for the reply..
      I tried and I got the script working. :)
      Just had to generate a new "form" thru javascript. Had to then parse
      the querystring and store them in an array and pass the hidden values.
      The form action is post. The hidden variables along with the form
      action is submitted thru a popup window..

      Thanks again for replying :)
      cheers !

      Comment

      Working...