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
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.