Submitting a form via JavaScript to a new window with out form tags.

I need t be able to submit a form with a single text box to another site for purposed of searching without the benefit of any form tags.

Our website runs on DotNetNuke and that has total control over the forms tags on each page. Otherwise, I'd just set the target attribute and be done with it.  I've got the form running within the same browser window but really want it to go to another window - not sure if a new browser window a'la 'target="_blank" is a possibility or if window.open is my only option.  I've seen lots of examples but everything relies on the form tag and that's something I don't have.  My feeble efforts either kill the form altogether or launch a window and kill the existing page. Any help would be greatly appreciated.

The code I'm using to submit the form is:

onclick="this.form.action='http://www.myexternallink.com/sales/find';this.form.submit();"

Open in new window


Many thanks in advance.
saabStoryAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hankknightCommented:
Would it be acceptable to send the form data using the GET method, or must it be send using the POST method?  
leakim971PluritechnicianCommented:
var param1 = encodeURIComponent( document.getElementById("field1_ID") );
var param2 = encodeURIComponent( document.getElementById("field2_ID") );
var paramN = encodeURIComponent( document.getElementById("fieldN_ID") );

location.href = "http://www.myexternallink.com/sales/find?param1=" + param1 + "&param2=" + param2 + "&paramN=" + paramN;

 

Open in new window


use $_GET (php), doGet(servlet), on the server side instead POST
Kiran SonawaneProject LeadCommented:
Look at this below code
<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Kiran Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>

<script>
 $(document).ready(function(){
   $("#submit").click(function(){
     data = $("input, select, textarea").serialize();
     window.location = "http://www.google.com?" + data;
     
   });
   
 });

</script>
</head>

<body>
<input type="text" name="FistName" id="FistName" />
<input type="text" name="FistName" id="FistName" />
<input class="submit" id="submit" type="submit" value="Submit">

</body>

</html>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
saabStoryAuthor Commented:
Just what I needed.  I couldn't use anything with GET as I'm sending the values from my for to the website of another company.  No big deal - just looking up event locations based on a zip code.

Many thanks this will work just great!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.