Post Data with Javascript and without using a form tag.

N

Neo

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="JavaScript">
<!--

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

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

<body>
<a href="#wf" onClick="JavaScript:LinkOpener('http://www.ntis.gov/search/results....y_Year=1990&frm_qry_MaxRec=100&frm_qry_Rank=1')">POST
request</a>
</body>
</html>

Thanks.
 
C

Csaba2000

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
 
N

Neo

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 !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,610
Members
45,255
Latest member
TopCryptoTwitterChannels

Latest Threads

Top