# king-addons/51.1.83/includes/widgets/MailChimp/script.js

King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder, version 51.1.83. 54 lines.

- Page: https://pluginprobe.com/plugins/king-addons/51.1.83/code/includes/widgets/MailChimp/script.js
- Raw: https://pluginprobe.com/plugins/king-addons/51.1.83/raw/includes/widgets/MailChimp/script.js
- Modified: 2026-09-16T13:52:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/king-addons/51.1.83/code/includes/widgets/MailChimp/script.js#L10-L20`.

```javascript
// noinspection JSUnresolvedReference

"use strict";
(($) => {
    $(window).on("elementor/frontend/init", () => {
        elementorFrontend.hooks.addAction(
            "frontend/element_ready/king-addons-mailchimp.default",
            ($scope) => {
                elementorFrontend.elementsHandler.addHandler(
                    elementorModules.frontend.handlers.Base.extend({
                        onInit() {
                            const $form = this.$element.find("form");

                            $form.on("submit", function (e) {
                                e.preventDefault();

                                const $btn = $(this).find("button");
                                const originalText = $btn.text();
                                $btn.text($btn.data("loading"));

                                $.ajax({
                                    url: KingAddonsMailChimpData.ajaxUrl,
                                    type: "POST",
                                    data: {
                                        action: "king_addons_mailchimp_subscribe",
                                        nonce: KingAddonsMailChimpData.nonce,
                                        fields: $(this).serialize(),
                                        listId: $form.data("list-id"),
                                    },
                                    success: (data) => {
                                        if ($form.data("clear-fields") === "yes") {
                                            $form.find("input").val("");
                                        }

                                        $btn.text(originalText);

                                        if (data.status === "subscribed") {
                                            $scope.find(".king-addons-mailchimp-success-message").show();
                                        } else {
                                            $scope.find(".king-addons-mailchimp-error-message").show();
                                        }

                                        $scope.find(".king-addons-mailchimp-message").fadeIn();
                                    },
                                });
                            });
                        },
                    }),
                    {$element: $scope}
                );
            }
        );
    });
})(jQuery);
```
