• Resolved Gillbergh

    (@gillbergh)


    Hi,
    I have a form embedded in a modal on my site. I have AJAX background submission enabled but when I submit the form it refreshes the page. When the form is on its own no problem but when I put it in the modal I have issues. Already contacted the developer of the other plugin that makes the modal and they said to contact you. Here is what they wrote

    It doesn’t appear the forms JS is loading. If your using a shortcode they may be using has_shortcode() to detect if your page contains the shortcode to determine wheather they should load scripts or not. Because the shortcode isn’t in the content of the page but in the footer has_shortcode() doesn’t work.

    See if you can get a response from them on forums and if not ill see what i can do.

    Hope you can help.

    My site is beta.culturesection.com, the form is in the bottom of the right navigation bar if you click subscribe. just put in a bogus email and name, i have it set to double opt-in. Thanks!

    https://wordpress.org/plugins/mailchimp-for-wp/

Viewing 1 replies (of 1 total)
  • Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Gillbergh,

    I took a closer look at your site and the plugin code and the plugin does indeed only load its code on pages where it’s actually needed.

    I just sent you an email containing a development version of the plugin where you can use the following piece of code to have the scripts loaded on every page of your website.

    function myprefix_load_mc4wp_ajax() {
    	global $mc4wp;
    	$mc4wp->get_form_manager()->load_ajax_scripts();
    }
    
    add_action( 'wp_enqueue_scripts', 'myprefix_load_mc4wp_ajax' );

    You can add the code to your theme its functions.php file or if you’re more code savvy you can create a separate plugin for it.

    Hope that helps, good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with form submission refreshing page’ is closed to new replies.