Within a Marketo landing page, that uses a form, I am using the form API's onSubmit() method to make an external POST call to a remote endpoint when the form is submitted. Works well.
When the form is submitted this of course also triggers creation of a lead in the Marketo database. Is there any way to prevent this from happening? So that the form can still be submitted, run the script tied to onSubmit(), but not actually create a new lead in Marketo.
The code I am adding to the LP (with a <script> tag) is below. Anything I can add here that would achieve the above and prevent Marketo lead creation? I thought maybe returning immediately after the API call might do it, but no luck. Thank you!!