I have a Visualforce page that's a form which is linked to my custom object in Salesforce.
However, I want the form to be saved and then redirect the user to my second Visualforce page (Thank You Page) without using an apex extension page.
I was told I can use JavaScript to do so however the code that I have written is not working as expected.
<apex:actionFunction name="saverecordandredirect" action="{!save}" oncomplete="location.href = '{! $Page.ThankYouPage }'" />
<apex:commandButton value="Save it" onclick="saveandredirtect() ;"/>
So please if anyone knows how I can achieve this, please let me know, thanks!