Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2003, 12:51 AM
Registered User
 
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default post a http request/response in new window nomenu

Hello,
I need to post a http request and have the response come back in a new window. I have tried the target attribute in the form element to open a new window for the response and it works. However I prefer to not have the menu bar/status bar in the new window. How should I specify these attributes for the new window? I would appreciate your responses.
Thank you.
 
Old September 22nd, 2003, 08:07 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You must open the new window first using the window.open method and include a name as the second parameter. Use this anme as the target attribute.

--

Joe
 
Old September 22nd, 2003, 03:17 PM
Registered User
 
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your response. When I open a new window what should I put for the first parameter (which is the name of some document)?

I could use the window.open instead of target attribute of form element, however then the request becomes a http "get" and there are some rules in the project that I work for that does not allow a http "get" request to come in.
Thank you.


 
Old September 23rd, 2003, 10:30 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

The first argument can be an empty string. I don't understand the second question. Instead of a submit button have a normal button with its onclick set to doFormPost():
Code:
function doFormPost()
{
  var oNewWin = window.open("", "newTarget", "");
  while(!oNewWin.document)
  {
    //Wait for window to open
  }
  document.forms[0].submit();
}
Your form would have the target attribute set to "newTarget".

--

Joe
 
Old August 12th, 2009, 08:58 AM
Registered User
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile a simpler way...

Hi all,

I use the following code, and it works fine!

Code:
<form name="login" method=post action="https://www.example.com/login.php" target="_blank">
    <input name="user" type="text" value="">
    <input name="pass" type="text" value="">
    <input type="submit" value="Go">
</form>
Greetings.

Joel





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to send http post request via stored procedure kissvineet SQL Server 2000 6 August 18th, 2008 12:26 AM
HTTP post silver_scar C# 2005 0 July 31st, 2006 09:52 AM
Using web request and response to post data to URl cgmenon .NET Framework 1.x 0 July 13th, 2006 10:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.