AnsweredAssumed Answered

Passing value to empty form isn't working.

Question asked by Ankit Patel on Jun 18, 2019
Latest reply on Jun 18, 2019 by Sanford Whiteman

Passing value to empty form (form submission in the background) isn't working. Any help with the code?

(https://developers.marketo.com/blog/make-a-marketo-form-submission-in-the-background/)


<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://app-lon08.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_10XX" style="display:none"></form>

 

<script>
MktoForms2.loadForm("https://app-lon08.marketo.com", "162-XXX-XXX", 10XX); 
MktoForms2.whenReady(function(mktoForm)

 {
     var myForm = MktoForms2.allForms()[0];

     myForm.addHiddenFields({

     "Email": $("#mwf3723fced2f65").val() ,
     "FirstName": $("#mwfca1d8fb14840").val(), 
     "LastName": $("#mwf2e0f8bf4c5a5").val(), 

  });
mktoForm.submit();
e.preventDefault();

});

</script>

 

Thanks.

Outcomes