Skip to content

Running js on submit of a form or on success #492

Discussion options

You must be logged in to vote

Hi @lpearson-trek10!

Thanks for the question.
You would have to write an event listener that listens to form submit events. The documentation for it is here

Assuming that you're using AJAX to submit forms, it would look something like this:

const myForm = document.getElementById("my-form");
myForm.addEventListener("freeform-ajax-success", function (event) {
  const form = event.form;
  const response = event.response;

  window.lintrk('track', { conversion_id: response.submissionId })
});

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lpearson-trek10
Comment options

@gustavs-gutmanis
Comment options

Answer selected by kjmartens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants