SweetAlert2 and Confirm dialog, how to execute action after an jQuery $.ajax call is executed?

I need to reload the page if a $.ajax call was successful (data.error is undefined). I am using jQuery and SweetAlert2 to display the confirmation dialog nicely and this is how my code looks like:

$(function () {
    Swal.fire({
        title: 'Are you sure you want to continue?',
        text: 'Are you sure you want to remove the selected files?',
        icon: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Yes',
        cancelButtonText: 'No',
    }).then((result) => {
        if (result.isConfirmed) {
            $.ajax({
                type: 'POST',
                url: 'http://localhost:8080',
                cache: false,
                dataType: 'json',
                success: function (result) {
                    if (result.error) {
                        // show error message here

                        return false;
                    }

                    location.reload();
                }
            })
        }
    });
})

As you can see I am executing the AJAX request when the user clicks the YES button from the SweetAlert2` confirm dialog.

The AJAX call is being done properly and it does not fail (data.error is undefined). The code should not enter in the if conditional and should reload the page but the reload is not happening and I am not sure what I am missing.

If I execute the AJAX call outside of the SweetAlert2 it works as expected and the page gets reloaded.

Can I get some help? Do you see something weird in my solution?