944,001 Members | Top Members by Rank

Ad:
Oct 16th, 2005
0

passing parameters to a page

Expand Post »
I have a javscript function which opens a url....The only thing is I need it to open pages with parameters, and I'm not sure how to do it:

<html>
<head>
<title>LinkOpener</title>
<script language="JavaScript">
<!-- 

function SearchTest(url, args)
{
	// if args is null, do the following
	window.open(url,'win1','width=600,height=700, status, toolbar, menubar, scrollbars, resizable')
	// else
	// implement your code
}

// -->
</script>

<body>
<h3>Search Test:</h3>
<a href="#wf" onClick="JavaScript:SearchTest('http://www.msn.com','')">GET request</a>
<br>
<a href="#wf" onClick="JavaScript:SearchTest('http://www.ntis.gov/search/results.asp?loc=3-0-0&search=','frm_qry_Category=ALL&frm_qry_Search=earth&frm_qry_Search=AND&frm_qry_Search=&frm_qry_Search=AND&frm_qry_Search=&frm_qry_Year=1990&frm_qry_MaxRec=100&frm_qry_Rank=1')">POST request</a>

</body>
</html>

If you can point me in the right direction or help me out in any way, I would really appreciate it.
Similar Threads
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Oct 31st, 2005
0

Re: passing parameters to a page

Simply concatentate URL and ARGs. In fact, you don't even need a separate variable and/or call for "args". They are simply part of the URL.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Oct 31st, 2005
0

Re: passing parameters to a page

Quote originally posted by tgreer ...
Simply concatentate URL and ARGs. In fact, you don't even need a separate variable and/or call for "args". They are simply part of the URL.
You can do that, but that doesn't make it using a post method. This was actually a problem my friend had, and we used some kind of xml thing to do the job, because javascript alone can't make post calls. I wish I could remember the name of it. It may have been called ajax or something.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Oct 31st, 2005
0

Re: passing parameters to a page

Well, you can only POST a message using a POST query. Any parameters passed via a URL, create a GET query.

Now, you could use JavaScript, to create a form, a lot of invisible variables, populate those variables, then call the form's "submit()" method, which will POST the form. You can only do that on a page you "own", of course.

"AJAX" is a funny little beast - it refers to scripting the XMLHttpRequest object. It doesn't do a POST, it fires off another request, "behind the scenes", so that the user doesn't see any page refresh.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Oct 31st, 2005
0

Re: passing parameters to a page

Quote originally posted by tgreer ...
Well, you can only POST a message using a POST query. Any parameters passed via a URL, create a GET query.

Now, you could use JavaScript, to create a form, a lot of invisible variables, populate those variables, then call the form's "submit()" method, which will POST the form. You can only do that on a page you "own", of course.

"AJAX" is a funny little beast - it refers to scripting the XMLHttpRequest object. It doesn't do a POST, it fires off another request, "behind the scenes", so that the user doesn't see any page refresh.
I guess AJAX was it. I remember working with the XMLHttpRequest. My first intentions was to create a form, because I have seen examples of 'dummy' forms created which do basically the same thing I was looking for. Either way I appreciate the replies.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Having trouble running javascript
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: JavaScript reference website or download





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC