-4

Hi I am trying to redirect to a URL on a form submission. Here's the page of the form:

http://thesomerset.com/test.php

I am trying to redirect on submission to this page:

http://thesomerset.com/resort.php

<script>
  function submitme() {
    window.open("http://www.thenavisway.com/reach/WebServicePost/SubscribeToList.aspx#arr0=" + "&account=15118&password=ddwj49kkyarqdhh6yayq&SubscriptionLists=Website" 
    + $("#email").val() + $("#firstname").val() + $("#lastname").val(), "_blank");
      }
</script>
James Hunt
  • 2,448
  • 11
  • 23
  • What isn't working? When you say "redirect" when is this redirect actually taking place? If it's a form post, why not redirect from the server? Or why not post the form itself to the target page? – David Jul 01 '14 at 14:44
  • After submitting the form. we would like it to go to a page on our website. – Harshad Methrath Jul 01 '14 at 15:01
  • Yes, but you need to understand the multiple steps which take place when you submit a form. You're currently trying to do this in JavaScript. Does this mean the form submit is using AJAX and you need to redirect in response to the success of that AJAX request? If you're not using AJAX, when is this JavaScript code supposed to execute? And again, why are you performing this redirect client-side at all and not server-side or just posting the form to the page you want to go to? – David Jul 01 '14 at 15:15
  • David, I am not a developer so I understand this very much. The company who's service we are using to capture the emails aren't helping much. So i tried my hand in doing this. I guess I can try redirecting through onsubmit or through the server side. – Harshad Methrath Jul 01 '14 at 16:55

2 Answers2

0

Use window.location to redirect and not opening new window.

window.location.href = "google.fr";

How to redirect to another webpage in JavaScript/jQuery?

Community
  • 1
  • 1
user2226755
  • 12,494
  • 5
  • 50
  • 73
0

Judging by the presence of the term "WebService" and your username and password in the URL in question, I'm guessing this is something you should be calling from the back end, not the front end. See file_get_contents for making a simple web request in PHP.

P.S. If that is your password, you might want to change it.

Jonathan S.
  • 2,238
  • 16
  • 16