10

Is it in gravity forms anyhow possible to fire an javascript event on an successful ajax form transmittion?

Adding html javascript into the displayed response does not seem to work eg:

<script>console.log("successful-form-transmition");</script>
Manuel
  • 9,112
  • 13
  • 70
  • 110
  • Adding plain javascript to text also works. Had an typo in "scirpt" which prevented it from working. – Manuel Jul 22 '15 at 14:55

1 Answers1

22

There's an event fired upon successful Gravity Forms submission: gform_confirmation_loaded. You can use it with jQuery like so:

$(document).on("gform_confirmation_loaded", function (e, form_id) {
  // code to run upon successful form submission
});

See documentation

Arnout Pullen
  • 185
  • 2
  • 13
Abraar Arique Diganto
  • 1,215
  • 16
  • 24
  • 3
    Thanks for this - I could only get it working with bind though, in case anyone else can't get it going -> `jQuery(document).bind("gform_confirmation_loaded", function (e, form_id) {` – McNab Jan 15 '16 at 17:25
  • thanks, but can I put this code in an html field in the form? dont seem to be working for me – async3 May 09 '19 at 13:32
  • 1
    And while probably obvious, make sure you embedded the form with ajax activated on. – Tom Woodward Sep 13 '19 at 14:36