Populating content dynamically via AJAX and Advanced Custom Fields [closed]

Here is what I ended up doing based on @gdaniel’s suggestion:

AJAX call:

$('.btn').click(function() {
    $.ajax({
        url:"<?php bloginfo('template_directory'); ?>/inc/galleries.php",
        type: 'POST',
        data: {postID: '<?=$post->ID;?>', galleryCategory: $(this).attr("data-content")},
        success: function(resp) {
            $('#photos').append(resp);

        }
    });
});

And here is my PHP file:

<?php 
require('../../../../wp-load.php');
$postid = $_POST['postID'];
$galcat = $_POST['galleryCategory'];
?>
<div class="photos" id="$galcat">
    <h1><?php echo $galcat; ?> Photos</h1>
    <?php if( have_rows($galcat,$postid) ): ?>
        <?php while( have_rows($galcat,$postid) ): the_row(); 

        // vars
        $photo = get_sub_field('photos');

        ?>
            <div class="image"><img src="https://wordpress.stackexchange.com/questions/156199/<?php echo $photo["sizes']['gallery-thumb']; ?>" alt="https://wordpress.stackexchange.com/questions/156199/<?php echo $photo["alt']; ?>" /></div>
        <?php endwhile; ?>

    <?php endif; ?>
</div>