Support

Account

Home Forums Backend Issues (wp-admin) Issues with Ajax dropdown change not fired Reply To: Issues with Ajax dropdown change not fired

  • Hi John thank you, i have seen your ansver on another thread, and i have tried to follow some of your explanations, sry i did not post my action, only my success.

    
     acf.addAction("new_field/key=field_6144c3e80231d", function($field) {
    
                    $field.on("change", function(e) {
                        var value = $field.val();
    
                        // ajax request
                        jQuery.ajax({
                            type: "POST",
                            dataType: 'text',
                            url: ajax_url,
                            data: {
                                action: 'call_update', 
                                postId: value,
                                nonce: wp_nonce
                            },
                            success: function(response) {
    
                                data = JSON.parse(response);
    
                                success(data);
                            },
                            error: function(jqxhr, textStatus, errorThrown) {
                                console.log(errorThrown);
                            }
                        });
    
                    });
                });
    

    But basicly, i should just check $(document).on(‘change’ in my success method. I will give it a go, and see if i can get it to work

    Regards Martin