Empty Server response sometimes in in Chrome

I have a strange issue on a website for a customer. He is hosting via GoDaddy.

Some context: It is a custom WordPress site fetching content via Ajax to load into the page.

Problem statement: When testing, I noticed some random occurrences for empty responses coming back from the server. Triggering the same request over and over, it happens that the response header is empty. This is strange as I had performed the same test seconds / minutes before.

This is the result of a successful response:

"finishTitle":"Bourland 2","finishNumber":"VP2","highlightImage":"https:\/\/qdr.app\/wp-content\/uploads\/2024\/08\/leathershandtas6-320x202-1.jpg","galleryImages":"<img src=\"https:\/\/qdr.app\/wp-content\/uploads\/2024\/08\/leathershandtas6-320x202-1-150x150.jpg\" class=\"selectedFinishImage\" data-large-src=\"https:\/\/qdr.app\/wp-content\/uploads\/2024\/08\/leathershandtas6-320x202-1.jpg\" alt=\"\" \/><img src=\"https:\/\/qdr.app\/wp-content\/uploads\/2024\/08\/leathershandtas3-320x202-1-150x150.jpg\" data-large-src=\"https:\/\/qdr.app\/wp-content\/uploads\/2024\/08\/leathershandtas3-320x202-1.jpg\" alt=\"\" \/><img src=\"https:\/\/qdr.app\/wp-content\/uploads\/2024\/06\/8CCL-Basement-Office-Doors-Looking-at-Egress-150x150.jpg\" data-large-src=\"https:\/\/qdr.app\/wp-content\/uploads\/2024\/06\/8CCL-Basement-Office-Doors-Looking-at-Egress-1024x681.jpg\" alt=\"\" \/><img src=\"https:\/\/qdr.app\/wp-content\/uploads\/2024\/08\/leathershandtas5-320x202-1-150x150.jpg\" data-large-src=\"https:\/\/qdr.app\/wp-content\/uploads\/2024\/08\/leathershandtas5-320x202-1.jpg\" alt=\"\" \/>"

With a response header looking like this:

https://preview.redd.it/evhdna9e9wrd1.png?width=635&format=png&auto=webp&s=2f5923a8aff85c45f5f7359bbbce00fa26f69610

Result from an empty response:

The response itself is empty.

We have the following response headers. You can see the difference.

https://preview.redd.it/07i4nuhg9wrd1.png?width=570&format=png&auto=webp&s=dc2ee5b59079e46f4d53dba6206c0756a458c984

What could cause this and how can it be solved?

My JavaScript

$(document).on('click', '.all-finishes-list li', function() 
        var finishId = $(this).data('finish-id');
        var $li = $(this);

        // Make an AJAX request to get the details for the clicked finish
        $.ajax(
            url: load_more_params.ajaxurl,
            type: 'POST',
            data: 
                action: 'fetch_finish_details',
                finish_id: finishId
            ,
            success: function(response) 
                if(!response) 
                    alert('empty') ;
                 else 
                    var data = JSON.parse(response);
                    // Update the highlighted image
                    // DO STUFF WITH IT
                

            ,
            error: function() 
                alert('Error updating finish details. Please try again.');
            
        );
    ); 

The related PHP code.

function fetch_finish_details() 
add_action('wp_ajax_fetch_finish_details', 'fetch_finish_details');
add_action('wp_ajax_nopriv_fetch_finish_details', 'fetch_finish_details');function 

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer