I'm sure that more people than just Murtza could answer this, but I've been going through the developers documentation to hide a form after successful submission, and either I'm adding the code to the wrong location, or it isn't working with the updated asynchronous code that support recommended for adding a forms 2.0 form to an RTP popup.
The code recommended by support was:
<form id="mktoForm_1589"></form>
<script type="text/javascript">// <![CDATA[
$.ajax({
cache: true,
async: true,
url: "//app-sj05.marketo.com/js/forms2/js/forms2.js",
dataType: "script",
success: function(){
MktoForms2.loadForm("//app-sj05.marketo.com", "867-SLG-901", 1589);
}
});
// ]]></script>
The code to hide the form upon submission is:
- MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form){
- //Add an onSuccess handler
- form.onSuccess(function(values, followUpUrl){
- //get the form's jQuery element and hide it
- form.getFormElem().hide();
- //return false to prevent the submission handler from taking the lead to the follow up url.
- return false;
- });
- });
Can anyone point me in the right direction of putting hose two together so that they hide the form upon submission? Thank you so much in advance!