I am trying to AJAX in a php file that uses Advanced Custom Fields fields, and get a 500 internal error when making the request. The php file works fine if I just use ‘include’, but I need to have it be dynamic in my JavaScript. My AJAX knowledge is limited but have started with this:
$(this).load('/wp-content/themes/theme-name/template-parts/uploads.php', function() { console.log('success'); });
That works to call basic text on the page, but as soon as I put in an ACF field, I get the 500 error.