- guest_22984534720053Asked on October 26, 2012 at 11:40 AM
I was wondering if the following is possible:
- The user clicks the submit button on the form
- The form is submitted via an ajax call to JotForm
- If the ajax call is successful, the form is hidden and replaced with a thank you message.
I understand that I could potentially achieve something similar by redirecting the user back to the current page and then hiding the form if a URL parameter is present e.g www.example.com/contact?submitted, but I was wondering if there was a more elegant approach?
- JotForm SupportNeilVicenteAnswered on October 26, 2012 at 12:43 PM
Embedding the form using iFrame method and configuring the form to use either the "Default Thank You Page" or "Thank You Message" as opposed to "Custom Thank You URL" should make your goal possible.
You can add an onLoad trigger to the form's iFrame codes so that upon URL change (submission), a script will load a separate PHP page on the iFrame where the form was initially loaded (which will then set a cookie).
Now, this cookie will determine whether to display the form on the page or not.
This purely theoretical solution is a little complicated and may seem like it will work, but I have not tested it yet. I will do some tests to see if it's feasible and will get back to you with the results.