Home Forums Front-end Issues Load acf_form() on click with ajax (almost working)


Load acf_form() on click with ajax (almost working)

  • Hi,

    I’m using acf_form() for displaying my options page on the frontend.I do this with ajax. Everything works except that the tabs and color pickers are not loaded. The select fields and repeaters work.

    The code below is not on click but it executes on the Div with #test as ID. I can make it on click later…

    If I don’t load acf_form() with ajax at the same position in the php file, it works.
    What am I missing?

        jQuery(document).ready(function($) {
            url: ajaxurl,
            data: {
            success:function(data) {
                // This outputs the result of the ajax request
            error: function(errorThrown){

    And inside functions.php

    function example_ajax_request() {
    if ( isset($_REQUEST) ) {
    $args = array(
    'post_id' => 'options',
    'form_attributes' => array(
    'class' => 'new-campaign-form',
    'field_groups' => array(16), //field group id
    'submit_value' => __("Save and Continue", 'acf'),
    acf_form( $args ); 
    add_action( 'wp_ajax_example_ajax_request', 'example_ajax_request' );

    How can I fix this? Ideas are welcome :), TY

  • On this page, almost at the end, see the section titled JavaScript

    you need to call acf.do_action('append', $('#popup-id'));

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

The topic ‘Load acf_form() on click with ajax (almost working)’ is closed to new replies.