0

I would really appreciate some help with a code I have. I want to redirect the submitter to any page of my choice after the form data has been submitted.

If you plug the code into the following link "http://www.w3schools.com/html/tryit.asp?filename=tryhtml_default" and follow the prompts, you'll see when it gets to the "Appointment Summary" page there is text at the top instructing the user to "click here to pay deposit". The issue I am having is people are not clicking the text to be redirected. I would like for after user submits form aka schedules appointment the appointment summary page is visible for a few seconds then the user is automatically redirected to the url page of my choice. I also don't want the text "CLICK+HERE+TO+PAY+YOUR+DEPOSIT" to be visible at all on the account summary, just redirect after form has been submitted.

Here is the code:

    <iframe id="schedulista-widget-00" 
    src="https://www.schedulista.com/schedule/neecostylez?
    mode=widget&rt_url=http://www.neecostylez.com/product-page/b58af64e-f174-6c25-a524-
    6388b7ddd6b7&rt_text=CLICK+HERE+TO+PAY+YOUR+DEPOSIT" ="true" 
    frameborder="0" scrolling="no" width="100%" height="900px">
    </iframe><script id="schedulista-widget-script-00" type="text/javascript" 
    src="https://www.schedulista.com/schedule/neecostylez/widget.js"></script>

This is where I'd like for it to be redirected too AFTER user has (submitted form) aka Scheduled their appointment. http://www.neecostylez.com/product-page/b58af64e-f174-6c25-a524-6388b7ddd6b7

Tally Boo
  • 1
  • 1
  • 5

2 Answers2

1

This is very simple window.location = "http://www.yoururl.com";

Here is the w3school link: http://www.w3schools.com/js/js_window_location.asp

If you need to redirect using PHP, this will be helpful: How to make a redirect in PHP?

Community
  • 1
  • 1
pcbabu
  • 2,219
  • 4
  • 22
  • 32
  • WC. You can write inline code Here is the link http://stackoverflow.com/questions/10607847/how-does-inline-javascript-in-html-work – pcbabu Nov 21 '16 at 21:13
  • Please try form action http://www.w3schools.com/TAGs/att_form_action.asp – pcbabu Nov 21 '16 at 21:16
0

Just add to this answer if anyone else is looking for the same this WOULD NOT WORK FOR SCHEDULISTA WIDGET . That is because of cross origin policy and schedulista doesnt give you access to their end code.

Below solution would only work if you have access to iframe code.

we add a event trigger like onClick to the submit button in the iframe and trigger a funtion in parent window.Calling funtion from iframe submit button using the following:

parent.redirect_function();

At this point in the parent window we can add a set timeout for how everlong you would like to wait before the redirection(reloading the url for the iframe.)

function redirect_function(){
setTimeout(function(){ 
document.getElementById('myframe').src = 'http://www.test.com'; 
}, 3000);
}



/* IFrame  */

<form method="post"  id="myform" name="myform" action="/"  >
<input type="text" name="input1" value="2073809442" />
<input type="text" name="input2" value="1" />
<input type="submit" name="submit" value="submit" onClick="return parent.redirect_function();" />
 </form>

/* Script in parent window */

    function redirect_function(){
    setTimeout(function(){ 
    document.getElementById('myframe').src = 'http://www.exsamp.com'; 
    }, 3000);
    }


/* Html for iframe in parent window */

<iframe frameborder="0" scrolling="no" width="530" height="298"
  src="iframe.html" name="myframe" id="myframe">
  <p>iframes are not supported by your browser.</p>
</iframe><br />
Saa_keetin
  • 647
  • 6
  • 10
  • Hello, thank you so much for replying. Do i just copy and paste this info into the body of my iframe for it to work? Im sorry for all the questions, I'm not too savvy with coding. – Tally Boo Nov 22 '16 at 20:03
  • so the function goes into the parent window, and then you add onClick="return parent.redirect_function();" to the book appointment button in your iframe, (submit button that gets you to the account summary page) – Saa_keetin Nov 22 '16 at 20:10
  • Hey, can we speak through email? – Tally Boo Nov 24 '16 at 15:22
  • Yes sure we can – Saa_keetin Nov 24 '16 at 19:50
  • https://docs.google.com/document/d/1hQe85Xq7UXnSHLXhbWwHmo0jXMYktcqrO_yaLo_j-NU/edit?usp=sharing <--- come here we can discuss – Saa_keetin Nov 26 '16 at 15:16