User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 370,599 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,036 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 6696 | Replies: 4
Reply
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation: server_crash is on a distinguished road 
Rep Power: 9
Solved Threads: 18
server_crash's Avatar
server_crash server_crash is offline Offline
Postaholic

passing parameters to a page

  #1  
Oct 16th, 2005
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Posts: 1,589
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: passing parameters to a page

  #2  
Oct 31st, 2005
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.
Reply With Quote  
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation: server_crash is on a distinguished road 
Rep Power: 9
Solved Threads: 18
server_crash's Avatar
server_crash server_crash is offline Offline
Postaholic

Re: passing parameters to a page

  #3  
Oct 31st, 2005
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.
Reply With Quote  
Join Date: Dec 2004
Posts: 1,589
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: passing parameters to a page

  #4  
Oct 31st, 2005
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.
Reply With Quote  
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation: server_crash is on a distinguished road 
Rep Power: 9
Solved Threads: 18
server_crash's Avatar
server_crash server_crash is offline Offline
Postaholic

Re: passing parameters to a page

  #5  
Oct 31st, 2005
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 6:21 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC