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>
You can use a shortcode in your text confirmation. Just use the same shortcode you used in the post to embed the form in the first place, and the form will be inserted into your text confirmation.
Go to Forms and open the one you wish to track. Click Confirmations. Usually, the Confirmation type is “Text” and what you'll need to do is to add a small JavaScript code there. It will create a Data Layer event “formSubmission” which we'll use later as a trigger.
Download, install, and activate the plugin. Navigate to your Form Settings to find the new Custom Javascript field. Once the plugin is installed and activated, you'll find the Custom Javascript field in your Form Settings. It includes a robust editor that will automatically highlight syntax to make it easy to read.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With