Link to home
Start Free TrialLog in
Avatar of Eroots
ErootsFlag for United States of America

asked on

Submit form to external action file and redirect page on one submit button

I have an email signup form for an external service (constant contact) on a splash page.

The code is below. I wanted to have the submit button both submit the form and redirect the page from the splash to main page, however I can't get the multiple actions to work.

I am limited in the sense that I have to have constant contact's form action, it pops up in a new window.

Any suggestions?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
  <head>
    <title>Welcome to ____</title>
    <link rel="stylesheet" type="text/css" href="/styles.css" />

<script type="text/javascript">
function submitform()
{
  document.myform.submit();
  window.location = "http://www.____.com";
}
</script> 

    <script type="text/javascript">
    try {
    var pageTracker = _gat._getTracker("UA-876977-25");
    pageTracker._trackPageview();
    } catch(err) {}</script>
  </head>
<body style="margin:0px; padding:0px; background-image:url(___/bg_texture.png);">
<div id="splashbox">
<div id="splashform">
<!-- BEGIN: Constant Contact Form -->
<form name="ccoptin" action="http://visitor.constantcontact.com/d.jsp" target="_blank" method="post">
<input type="text" name="ea" size="26" value="&nbsp;email:" style="font-family:Verdana,Geneva,Arial,Helvetica,sans-serif; font-size:18px; border:1px solid #DDDDDD; height:24px; line-height:24px;">
<br /><br />
<input onclick='submitform();' type="image" src="____/splashsubmit.png" >
<input type="hidden" name="m" value="1102336606191">
<input type="hidden" name="p" value="oi">
</form>
<!-- END: Constant Contact Stylish Email Newsletter Form -->
<!-- BEGIN: SafeSubscribe -->
<a href="http://www.constantcontact.com/safesubscribe.jsp" target="_blank">Privacy by SafeSubscribe&#8480;</a>
<br />
<a href="http://www._____.com">Continue to main page</a>
<!-- END: SafeSubscribe -->
</div>
</div>
<div id="splashfooter">

</div>
</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Greg Alexander
Greg Alexander
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eroots

ASKER

awesome awesome awesome!

Can't thank you enough for this working solution. I'm very new to the powers of JQuery and AJAX, so I appreciate the working example.