Ошибка при отправке ajax формы

Это моя первая ajax функция.

Есть два select, в каждом выбирается игрок и есть кнопка button. Данные передаются в script.php, откуда просто должно вывести, что все передалось, но вылетает ошибка Uncaught SyntaxError: Unexpected end of JSON input

html:

  <form method="POST" action ='' id = 'form'>  
    <dt>КТО С КЕМ?</dt>
    <div id="social" class="section">
      <h1>Игрок 1</h1>
      <dl>
        <div class="select">
          <select name='player-1'>
              <?=$players;?>
          </select>
        </div>
      </dl>
    </div>  

    <div id="bots" class="section">
      <h1>Игрок 2</h1>
      <dl>
        <div class="select">
          <select  name='player-2'>
            <?=$players;?>
          </select>
        </div>
      </dl>     
    </div>

    <div id="bots" class="section">
      <h1>Игрок 2</h1>
      <dl>
    
          <button type='submit' name='submit'> START </button>

      </dl>     
    </div>
</form>
         
<div id="share" class="section clearRow">
      
    </div>

sript.php

<?php
if (isset($_POST['submit']))
{

  $answer = [
        'status' => 'ok',
        'message' => 'It is working!'
    ];
    echo json_encode($answer);
}
?>

ajax:

$(document).ready(function() {
    var form = $('#form');
    form.submit(function(event) {
        event.preventDefault(); // Добавили, чтобы страница не перезагружалась
        $.ajax({
            url: 'script.php',
            type: 'POST',                        
            data: form.serialize(), // Передаём данные
            success: function(response) {
                var result = JSON.parse(response);
                $("#share").html(result.message);
            },
        });
    })
});

Ответы (0 шт):