• Resolved Messaone

    (@messaone)


    Hey there.

    I’m using this script i php
    Do add Ajax button function – everything works perfect – but I can’t find a away to reload the page after submit is done. Do you have an hint for me?

    add_action('acfe/fields/button/name=my_button', 'my_acf_button_ajax', 10, 2);
    function my_acf_button_ajax($field, $post_id){
        
        wp_send_json_success('Success!');
        
    }
Viewing 1 replies (of 1 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    As explained in my answer in your previous topic, you will have to use the javascript window.location object in the acfe/fields/button/success/name=my_button JS hook to refresh or redirect a page after a successful Ajax request. See documentation.

    Usage example:

    acf.addAction('acfe/fields/button/success/name=my_button', function($el, data){
        
        // Refresh page
        window.location.reload();
    
    });
    

    Hope it helps!

    Have a nice day!

    regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Reload page after button click’ is closed to new replies.