<script> //Replace formID with your form's ID document.querySelector("#formID").addEventListener("submit", (e) => { // Collect form field values const rhSubmitData = Object.fromEntries(new FormData(e.target).entries()); // Store data in localstorage because page is going to redirect. Replace routerID. localStorage.setItem('rhdata', JSON.stringify(rhSubmitData)); localStorage.setItem('rhid', 'routerID'); //Set redirection link to thank you page. Replace with your URL. window.location.href = "https://redirect.com";});</script>
Replace the following in the aformentioned script:
<script type="text/javascript" src="https://app.revenuehero.io/scheduler.min.js"></script><script>//retrieve the data from local storagevar revdata = localStorage.getItem('rhdata'); if(revdata !== null) { var jsonData = JSON.parse(revdata);//pass the data to RevenueHero and call the scheduler window.hero = new RevenueHero({ routerId: localStorage.getItem("rhid") }) hero.submit(jsonData).then(function(sessionData) { hero.dialog.open(sessionData);//delete the data from local storage localStorage.removeItem("rhdata"); localStorage.removeItem("rhid"); });}</script>