diff --git a/Resources/Private/Templates/Form/Index.html b/Resources/Private/Templates/Form/Index.html
index 4928688..c69a3eb 100644
--- a/Resources/Private/Templates/Form/Index.html
+++ b/Resources/Private/Templates/Form/Index.html
@@ -5,13 +5,12 @@
-
diff --git a/Resources/Public/JavaScript/mailchimp.js b/Resources/Public/JavaScript/mailchimp.js
index 24cd9f9..0c51e0a 100644
--- a/Resources/Public/JavaScript/mailchimp.js
+++ b/Resources/Public/JavaScript/mailchimp.js
@@ -1,22 +1,27 @@
+$(function () {
+ let $extMailchimpForms = $('form.mailchimp-form');
-$(document).on('submit', '#mailchimp-form', function (e) {
- 'use strict';
+ if ($extMailchimpForms.length) {
- let $this = $(this),
- url = $this.data('url');
+ $extMailchimpForms.on('submit', function (e) {
- if (url) {
- e.preventDefault();
+ let $this = $(this),
+ url = $this.data('url');
- $.ajax({
- type: 'POST',
- url: url,
- data: $this.serialize(),
- dataType: 'html',
- encode: false
- })
- .done(function (data) {
- $('#mailchimp-ajax-response').html(data);
- });
+ if (url) {
+ e.preventDefault();
+
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: $this.serialize(),
+ dataType: 'html',
+ encode: false
+ })
+ .done(function (data) {
+ $('.mailchimp-ajax-response', $this).html(data);
+ });
+ }
+ });
}
-});
+});
\ No newline at end of file