WordPress.org

Forums

Contact Form 7
Form won't display within ajax request response-wp_ajax (1 post)

  1. QuanticaLabs
    Member
    Posted 3 years ago #

    I'm trying to display contact form from ajax request response:

    function my_ajax_get_content()
    {
    	echo do_shortcode(apply_filters("the_content", "[contact-form-7 id='808' title='Contact form 1']"));
    	exit();
    }
    add_action("wp_ajax_nopriv_get_content", my_ajax_get_content");

    But the form won't render. On the page I can see just raw shortcode: [contact-form-7 id="808" title="Contact form 1"]

    If I place echo do_shortcode("[contact-form-7 id='808' title='Contact form 1']"); for example in footer.php, then it works.

    What should I do to render the shortcode within ajax request response?

    http://wordpress.org/extend/plugins/contact-form-7/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic