Marketo + Chilipiper integration

by Angel Ordax

HTML

<script src="//app-sjn.marketo.com/js/forms2/js/forms2.min.js"></script>
<script>MktoForms2.loadForm("//app-sjn.marketo.com", "685-KBL-765", 5241);</script>

<script>

  MktoForms2.whenReady(function (form){

    //Add an onSuccess handler
     form.onSuccess(function(values, followUpUrl){

      //get the form's jQuery element and hide it
      form.getFormElem().hide();

      window.scrollTo(0,0);

      document.getElementById('confirmForm').classList.add('show');

      // load chilipiper
      ChiliPiper.submit("devex", "recruitment-account-inquiry", {map:true, formId: "mktoForm_5241"});

      //return false to prevent the submission handler from taking the lead to the follow up url.
      return false;

    });

  });
</script>


<script src="https://code.jquery.com/jquery-2.2.0.min.js" type="text/javascript"></script>    

<script>
  $(document).ready(function() {
    // Show thank you message
    if (window.location.search.indexOf("thank_you=true") > -1) {
      document.getElementById('confirmForm').classList.add('show');
      document.getElementById('confirmFormMobile').classList.add('show');
      document.getElementById('mktoForm_5241').classList.add('hide-all');
    }
  })

</script>


<script>
  function q(a) {return function() {ChiliPiper[a].q = (ChiliPiper[a].q || []).concat([arguments])}}window.ChiliPiper = window.ChiliPiper || "submit scheduling showCalendar submit widget bookMeeting".split(" ").reduce(function(a,b) {a[b] = q(b);return a},{});
  ChiliPiper.scheduling("devex", "recruitment-account-inquiry", {formId: "mktoForm_5241",title: "Thanks! What time works best for a quick call?"})
</script>

<script>
  function q(a) {return function() {ChiliPiper[a].q = (ChiliPiper[a].q || []).concat([arguments])}}window.ChiliPiper = window.ChiliPiper || "submit scheduling showCalendar submit widget bookMeeting".split(" ").reduce(function(a,b) {a[b] = q(b);return a},{});
  ChiliPiper.scheduling("devex", "recruitment-account-inquiry", {formId:...