Home › Forums › ACF PRO › Loading New Advanced Custom Fields Row With Ajax › Reply To: Loading New Advanced Custom Fields Row With Ajax
So, if you want to only return one value, you don’t need to really use json, but it’s still a good idea. The problem with your code is that you’re not adding to the current row, you’re just returning the same value you’re sending.
add_action( 'wp_ajax_my_ajax_action', 'my_ajax_action_callback' );
add_action( 'wp_ajax_nopriv_my_ajax_action', 'my_ajax_action_callback' );
function my_ajax_action_callback() {
if(isset($_POST['newRowId'])){
$new_row_id = $_POST['newRowId']+1;
echo $new_row_id;
exit;
}
else {
echo "its null mannn";
exit;
}
}
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.