Skip to main content
February 12, 2016
Question

How to get a lead id on sccess event

  • February 12, 2016
  • 2 replies
  • 1203 views

Get lead id on success event of marketo form

<script>
MktoForms2.loadForm("//app-sj07.marketo.com", "11-11-11", 12, function(form) {
  // Add an onSubmit handler
  form.onSuccess(function(){
  // Get the form field values
  var vals = form.vals();
  alert("Submitted values: " + JSON.stringify(vals));
  });
  });
</script>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Grégoire_Miche2
Level 10
February 12, 2016

Hi Mayank,

Place the {{lead.ID}} token in your page, in a hidden position, then use Javascript to collect the value and pass it to your script.

-Greg

SanfordWhiteman
Level 10
February 12, 2016

Is this a question or a statement?  Obviously, your code does not work. Unfortunately, Greg's pointer won't work reliably either.  I've explained this in other posts.  Please search for them and/or provide more explanation in your questions.