jQuery Ajax not loading page with ACF fields

You are making direct calls to a PHP file in your theme, this is why you have the problem. Because WordPress didn’t handle the request, your file did, none of WordPress is loaded, and none of the plugins. There are also lots of security issues with this approach.

If you need to make an AJAX request, make it to a REST API endpoint.

For example, here I register an endpoint that returns Hello World:

add_action( 'rest_api_init', function () {
    register_rest_route( 'jeno/v1', '/helloworld/', [ 'callback' => 'helloworld' ] );
} );

function jeno_helloworld( $data ) {
    return "Hello World";
}

After placing that in a plugin or functions.php, then I can visit this URL to get the response:

http://example.com/wp-json/jeno/v1/helloworld

"Hello World"

Here’s a snippet of code

jQuery.ajax({
    url: "https://example.com/wp-json/jeno/v1/helloworld"
}).done(function( data ) {
    // do something with data
    console.log( data ); // prints hello world in the dev tool console
});

If you need any parameters, use the $data variable. REST API’s return their response as JSON, so you can JSON decode in javascript to get more complex results.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)