Support » Plugin: Official MailerLite Sign Up Forms » JQuery not defined with WP Rocket Plugin

  • Resolved Salar Gholizadeh

    (@salar6990)


    Hi. there is an issu with inline javascript which is caused when the JQuery is deffered. you can fix this by replacing the inline script tag on
    include/templates/forms/custom_form.php

    with this one:

    <script type=”text/javascript”>
    window.addEventListener(“load”,function(event) {
    var jQuery = window.jQueryWP || window.jQuery;
    var form_container = jQuery(“#mailerlite-form_<?php echo $form_id; ?>[data-temp-id=<?php echo $unique_id; ?>] form”);
    form_container.submit(function (e) {
    e.preventDefault();
    }).validate({
    submitHandler: function (form) {

    jQuery(this.submitButton).prop(‘disabled’, true);

    form_container.find(‘.mailerlite-subscribe-button-container’).fadeOut(function () {
    form_container.find(‘.mailerlite-form-loader’).fadeIn()
    });

    var data = jQuery(form).serialize();

    jQuery.post(‘<?php echo admin_url( ‘admin-ajax.php’ ); ?>’, data, function (response) {
    form_container.find(‘.mailerlite-form-inputs’).fadeOut(function () {
    form_container.find(‘.mailerlite-form-response’).fadeIn()
    });
    });
    }
    });
    },false);

    </script>

Viewing 2 replies - 1 through 2 (of 2 total)
  • furnituresuppliesuk

    (@furnituresuppliesuk)

    Hi Salar,

    Please can you tel me the full path to this file,

    I’ve looked around but cant seem to find it.

    Thanks in advance.

    Lee

    @mailerlite any updates on this? this codes makes mailerlite compatible with deffering js scripts which is commonly used in script optimizing. currently I have to edit this everytime I update the plugin.

    @furnituresuppliesuk sorry for my late late reply! the path, as I mensioned, is this:
    wp-content/plugins/official-mailerlite-sign-up-forms/include/templates/forms/custom_form.php

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘JQuery not defined with WP Rocket Plugin’ is closed to new replies.