Title: Async load causes plugin malfunction
Last modified: December 12, 2017

---

# Async load causes plugin malfunction

 *  Resolved [SHiRKiT](https://wordpress.org/support/users/shirkit/)
 * (@shirkit)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/async-load-causes-plugin-malfunction/)
 * Hey,
 * So I’ve been trying to improve my loading times in my local dev website, so I
   tried to load the scripts that MDfCF7 needs using an eval after the page is already
   loaded.
 * But when I do that, when I click the submit button, the page is loaded with localhost/
   wordpress/#wpcf7-f4-p82-o1 and the design breaks, instead of the default behavior,
   that is to block the page reload and present the errors/sucess below the form.
 * Here’s how I’m loading the code, I don’t get what I’m doing wrong, since doing
   defer in the script works perfectly.
 *     ```
       const scripts = {contact:["https://shirkit.local/wordpress/wp-content/plugins/contact-form-7/includes/js/scripts.js","https://shirkit.local/wordpress/wp-content/plugins/material-design-for-contact-form-7/public/../assets/js/lib/material-components-web.min.js","https://shirkit.local/wordpress/wp-content/plugins/material-design-for-contact-form-7/public/../assets/js/lib/autosize.min.js","https://shirkit.local/wordpress/wp-content/plugins/material-design-for-contact-form-7/public/../assets/js/cf7-material-design.js"]};
   
       jQuery.getMultiScriptsSeq = function(scripts) {
       	var xhrs = scripts.map(function(url) {
       		return $.ajax({
       			url: url,
       			dataType: 'text',
       			cache: true
       		});
       	});
   
       	return $.when.apply($, xhrs).done(function() {
       		Array.prototype.forEach.call(arguments, function(res) {
       			window.eval.call(this, res[0]);
       		});
       	});
       }
   
       jQuery.getMultiScriptsSeq(scripts.contact);
       ```
   
 * shirkit.local is just a shortcut to localhost.
    -  This topic was modified 8 years, 6 months ago by [SHiRKiT](https://wordpress.org/support/users/shirkit/).
    -  This topic was modified 8 years, 6 months ago by [SHiRKiT](https://wordpress.org/support/users/shirkit/).

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

 *  Thread Starter [SHiRKiT](https://wordpress.org/support/users/shirkit/)
 * (@shirkit)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/async-load-causes-plugin-malfunction/#post-9776937)
 * Also, as an additional quesiton, can I disable the Google Fonts usage?
 * I’m bundling all my fonts in a single file with base64 encoding, which is proving
   to be faster due to 3G connections having huge RRT times here. I could just put
   Roboto there as well.
 *  Plugin Author [GusRuss89](https://wordpress.org/support/users/gusruss89/)
 * (@gusruss89)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/async-load-causes-plugin-malfunction/#post-9777022)
 * Hi [@shirkit](https://wordpress.org/support/users/shirkit/)
 * I’m not sure why you’re getting that behaviour, but it sounds more to do with
   CF7 than my plugin.
 * Here’s a support thread from a few weeks ago also about performance. I recommended
   using [Autoptimize](https://wordpress.org/plugins/autoptimize/) for deferring
   and concatenating scripts, and there’s also some PHP to dequeue stylesheets etc
   on pages where you don’t need it.
 * [https://wordpress.org/support/topic/above-the-fold-blocking/](https://wordpress.org/support/topic/above-the-fold-blocking/)
 * Thanks,
    Angus

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

The topic ‘Async load causes plugin malfunction’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/material-design-for-contact-form-
   7_f8f8f8.svg)
 * [Material Design for Contact Form 7](https://wordpress.org/plugins/material-design-for-contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/material-design-for-contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/material-design-for-contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/material-design-for-contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/material-design-for-contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/material-design-for-contact-form-7/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [GusRuss89](https://wordpress.org/support/users/gusruss89/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/async-load-causes-plugin-malfunction/#post-9777022)
 * Status: resolved