I want to make search in my username database but it doesnt recognize keypress function. also, I want to prevent search.php on first load (can't use isset because there is no button) this is my index.php
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<head>
  <title></title>
  <?php  include 'search.php'; ?>
  <script>
    $(document).ready(function() {
      $("#textbox1").keypress(function() {
        $.ajax({
          type: "GET",
          url: "search.php",
          success: function(data) {
            $("#main").html(data);
          }
        });
      });
    });
  </script>
  <form method="POST">
    enter keyword to search<br>
    <input type="text" name="textbox1" id="textbox1">
    <br><br>
    <div id="main"></div>
  </form>
</head>
<body>This is my search.php. the connection.php is working proper. so I'm not pasting it here
<?php
    include 'connection.php';
    $search_value = $_POST['textbox1'];
    $query = "SELECT username FROM users WHERE username LIKE '" . $search_value . "%'";
    $conn_status = mysqli_query($conn, $query);
    while($row = $conn_status->fetch_assoc())
    {
        echo $row['username'] . '<br>';
    }
?>
 
     
     
    