The successful submission pop-up window does not appear after adding the php script

When I click the "Send" button, the message successful sending pop-up window does not appear, although the data is being sent. This does not work after adding the php script:
ob_start();

try {
// ===== НАЛАШТУВАННЯ =====
$api_key = 'ВАШ_API_КЛЮЧ_KEYCRM';
$pipeline_id = 1;
$source_id = 5;
$form_title = 'Запит на візуалізацію';
$site_url = 'https://fotory.com.ua';
// ========================

$api_url = 'https://openapi.keycrm.app/v1';
$uploads_dir = '/images/baforms/uploads/form-3/';

$messenger_type = isset($_POST[8]) ? trim($_POST[8]) : '';

$messenger_number = '';
foreach ([9, 10, 11] as $key) {
if (!empty($_POST[$key])) {
$messenger_number = trim($_POST[$key]);
break;
}
}

$digits_only = preg_replace('/[^\d]/', '', $messenger_number);
$phone_clean = (strlen($digits_only) >= 10)
? '+' . ltrim(preg_replace('/[^\d+]/', '', $messenger_number), '+')
: null;

$file_comment = '';
if (!empty($_POST[7])) {
$file_json = json_decode($_POST[7], true);
$file_info = $file_json ? reset($file_json) : [];
$filename = $file_info['filename'] ?? '';
if ($filename) {
$file_name = $file_info['name'] ?? $filename;
$file_comment = "Файл: {$file_name}\n{$site_url}{$uploads_dir}{$filename}";
}
}

$contact = [
'full_name' => $messenger_type,
'messengers' => [['type' => strtolower($messenger_type), 'login' => $messenger_number]],
];
if ($phone_clean) {
$contact['phone'] = $phone_clean;
}

$lead_payload = [
'pipeline_id' => $pipeline_id,
'source_id' => $source_id,
'title' => $form_title,
'manager_comment' => $file_comment,
'contact' => $contact,
];

$ch = curl_init($api_url . '/leads');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $api_key,
'Content-Type: application/json',
'Accept: application/json',
],
CURLOPT_POSTFIELDS => json_encode($lead_payload),
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_TIMEOUT => 10,
CURLOPT_CONNECTTIMEOUT => 5,
]);
curl_exec($ch);
curl_close($ch);

} catch (Throwable $e) {
}

ob_end_clean();

Replies are visible only to logged in members with an active subscription.