• Resolved Messaone

    (@messaone)


    Hey, is there anyway i can trigger opening a new tab? After success?

    I tried -> and i see in the developer console that it shows up in the network tab.
    But i want to redirct after success to a page or file.

    add_action('acfe/fields/button/name=pdf_de_erstellen', 'my_acf_button_ajax', 10, 2);
    function my_acf_button_ajax($field, $post_id){
        
    	require_once 'pdf-create-backend.php';
    	
    	wp_send_json_success( array( 'url' => 'FILE.pdf' ) );
    	return true;
    }
    • This topic was modified 3 years, 9 months ago by Messaone.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback! There’s different questions in your report:

    – To open a tab on success you’ll have to use Javascript success hook acf.addAction('acfe/fields/button/success/name=my_button') (See documentation) and then write your code to open a tab in it. You can take a look at the acf-input.js source code from ACF to check how to open a tab.

    – To redirect the user on successful ajax request, you’ll have to use the same acf.addAction('acfe/fields/button/success/name=my_button') javascript hook, and redirect the user with javascript using window.location.href for example. You’ll find more information about how to redirect a page in javascript on the web. Example: https://www.w3schools.com/howto/howto_js_redirect_webpage.asp

    Hope it helps!

    Have a nice day!

    Regards.

    Thread Starter Messaone

    (@messaone)

    Thanks for your help

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘acfe/fields/button/ Ajax’ is closed to new replies.