Hi @jepser
Can you please check your console log in combination with debugging your code to check the value of each line of code.
i think the issue may be this:
global $post;
$current_template = get_post_meta($post->ID, 'custom_post_template',true);
In an AJAX call, there is no global $post
Take a look at ACF’s core location code to see where it gets’ it’s $post_id from
Thanks
E