PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Enqueue jQuery with CDN and in the footer causing AJAX errors/spinner error

  1. I'm loading jQuery in the footer and with Google's CDN and its causing the AJAX loader and errors to not appear. Thoughts?

    function ps_load_jquery_footer() {
    	if ( !is_admin() ) {
    		wp_deregister_script( 'jquery' );
    		wp_register_script( 'jquery', get_template_directory_uri() . "/js/jquery-1.7.1.min.js", false, '1.7.1', true );
    		wp_enqueue_script( 'jquery' );
    	}
    }
    add_action('init', 'ps_load_jquery_footer');
    Posted 8 years ago on Monday January 9, 2012 | Permalink
  2. Did some more research and found this topic:

    http://www.gravityhelp.com/forums/topic/submit-validation#post-42771

    It seems that jQuery needs to be loaded in the header, is there any way around this? Obviously best practice for Javascript is to load in the footer, not sure why Gravity Forms would break that standard...

    Posted 8 years ago on Monday January 9, 2012 | Permalink
  3. jQuery needs to be loaded in the header so it's available to Gravity Forms when the page renders. There is currently no way around that but we are always evaluating best practices and will think carefully about the best way to accomplish this. Thank you.

    Posted 8 years ago on Wednesday January 11, 2012 | Permalink
  4. It would be nice to find a way.
    some other plugin like contact form 7 don't need to load jquery in top
    Can't you just display the script after the WP_footer hook ? jquery would be loaded before in all case.
    the javascript code doesn't need to be just after the form html to work well.

    thank you.

    Posted 7 years ago on Tuesday January 15, 2013 | Permalink
  5. @emixfr, are you having trouble with a form or are you just providing feedback regarding how the JavaScript is being loaded? If you're having trouble with a form, please provide a link to the form in a new topic with a description of your problem. Thank you.

    Posted 7 years ago on Tuesday January 15, 2013 | Permalink

This topic has been resolved and has been closed to new replies.