Support forumCategory: QuestionsOpen bootstrap form dynamically in modal.
breeves asked 3 weeks ago

I have three workers and want to be able to click on a button for that woker and have a form popup with that worker as the default. I’m trying to do it with ajax using the following code in my functions.php file:

add_action(‘wp_ajax_appointment_shortcode’, ‘appointment_shortcode’);
add_action(‘wp_ajax_nopriv_appointment_shortcode’, ‘appointment_shortcode’);
function appointment_shortcode()
{
echo ‘<div class=”appointment-modal”>’;
echo do_shortcode(‘

‘);
echo ‘</div>’;
wp_die();
}

This just returns the shortcode text, not the form. Why would that be? I’ve tested other shortcodes and they work just fine.
 
Thanks.

breeves replied 3 weeks ago

Code isn’t formatting right in these comments. Here’s a screen shot of the code:

http://199.167.254.140/wp-content/themes/sublux/Screen%20Shot%202020-11-16%20at%2010.15.09%20AM.png

1 Answers
Nikola Loncar Staff answered 3 weeks ago

Hi, there are scripts that are enqueued. Those scripts are added to footer when shortcode is added to page but you don’t have those scripts on that page?

Best regards,
Nikola