I have an application in PHP, which receives data from the client that is in another domain. Data arrives from the fetch API via the POST method, but PHP doesn't send a response to the fetch API.
foo.com/endpoint.php:
<?php
include_once('database/connection.php');
header('Content-Type: application/json');
$ip = $_POST["ip"];
$city = $_POST["city"];
$state = $_POST["state"];
$country = $_POST["country"];
$category = $_POST["category"];
// Checking if the req ip already have registered other req
$ip_query = "SELECT * FROM registers WHERE `ip` = '$ip'";
$ip_result = mysqli_query($conn, $ip_query);
$ip_check = mysqli_fetch_assoc($ip_result);
if (!$ip_check) {
    // registering data after validation
    $new_query = "INSERT INTO `registers` (`ip`, `city`, `state`, `country`, `category`, `created`) VALUES ('$ip', '$city', '$state', '$country', '$category', '2022-07-21 00:00:01')";
    $new_create = mysqli_query($conn, $new_query);
    $result = array(
        'ok' => true,
        'status' => 200
    );
    // sending response
    http_response_code(200);
    echo json_encode($result);
} else {
    // sending response if already registered
    http_response_code(503);
}
Client side fetch code:
fetch(this.url, {
                method: 'POST',
                mode: 'no-cors',
                body: this.getFormValues(),
                headers: {
                    "Accept": "application/json",
                    'Content-Type': 'application/json'
                  }
            })
            .then(resp => resp.json())
            .then(data => {
                console.log(data)
                if (data.ok) {
                    this.Metrics.setSent()
                } else {
                    throw Error(r.statusText)
                }
            })
            .then(() => {
                this.Metrics.setSent()
                this.Metrics.dismiss()
            })
            .catch(erro => {
                console.log("Erro: ",erro)
                this.Metrics.dismiss()
            });
It's all right about storing data, my problem is just sending the response :(