Ajax request not completed, values not reflected in database

I am trying to create editable table, I am using ajax request for the same by following a tutorial over youtube, but the ajax request to save the changes after editing the table seems to fail, please suggest me the possible mistake that is causing the error “Not saved”.
Main page code

 <script type='text/javascript'>
$(document).ready(function(){
  
 // Show Input element
 $('.edit').click(function(){
  $('.txtedit').hide();
  $(this).next('.txtedit').show().focus();
  $(this).hide();
 });
 
 // Save data
 $(".txtedit").focusout(function(){
   
  // Get edit id, field name and value
  var id = this.id;
  var split_id = id.split("_");
  var field_name = split_id[0];
  var edit_id = split_id[1];
  var value = $(this).val();
   
  // Hide Input element
  $(this).hide();
 
  // Hide and Change Text of the container with input elmeent
  $(this).prev('.edit').show();
  $(this).prev('.edit').text(value);
 
  $.ajax({
  url: 'update.php',
  method: 'POST',
  data: { field:field_name, value:value, id:edit_id },
  success:function(response){
    if(response == "success"){ 
      console.log('Saving successfully'); 
    }else{ 
      console.log("Not saving.");  
    }
  },
  error: function(xhr, status, error) {
    console.log("Error: " + xhr.responseText);
  }
});
  
 });
 
});
</script>

</head>
<body>
<div id="bgn"></div>
<div id="titlebar">
  <h1 id="pageTitle">PROJECT MANAGEMENT SYSTEM</h1>
  <div id="bg1"></div>

<div id="menu">
  <ul id="menuitems">
    <li>
      <div class="menu-item">
        <span class="icon-signini" onclick="signOut()"></span>
        <span class="item" onclick="signOut()">Sign Out</span>
      </div>
    </li>

    <li>
      <div class="menu-item" id="masterdata">
          <span class="icon-dashbi"></span>
          <span class="item">Master Data</span>
        <!-- Submenu -->
        <ul id="projectSubMenu" class="submenu" onclick="department_table()">
          <li><span>Department List</span></li>
          <div class="departable">


</div>
          <li><span onclick="project_table()">Projects List</span></li>
        </ul>
      </div>
    </li>

    <li>
      <div class="menu-item">
        <span class="icon-transi"></span>
        <span class="item">Transactions</span>
        <!-- Submenu -->
      </div>
    </li>

    
<li>
      <div class="menu-item">
        <div class="project">
          <span class="icon-requestpi"></span>
          <span class="item" onmouseover="toggleSubmenu('projectSubMenu')">Reports</span>
        <!-- Submenu -->
        <ul id="projectSubMenu" class="submenu">
        </ul>
      </div>
    </li>

  </ul>
</div>
</div>


<div id= "tablePane"  style="display: none;">
<div id= departtableTitle>
  <h1>DEPARTMENT TABLE</h1>
  </div>
  <div id= buttons>
  <button class="btn" type="button" name="add">Add</button> 
  <button class="btn" type="button" name="save" onclick="save">Delete</button>
  <button class="btn" type="button" name="save">Edit</button>
  <button class="btn" type="button" name="save">Save</button>
  </div>
<div class="tableContainer">
    <table class="departable" id="department_table">
    <thead>
        <th>Sr No.</th>
        <th>Name</th>
        <th>Username</th>
        <th>Email</th>
        <th>Department</th>
</thead>

<tbody>
        <?php
        include('db.php');

        // Create connection
        $conn = new mysqli($hostname, $user_name, $pass_word, $database);
        
        // Check connection
        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        }
        
        $query_departid= " SELECT `department` FROM `department id`";
        $query_departable= " SELECT `id`,`name`,`username` ,`email`, `department id` FROM `users`order by `id`";
        $result_departable= mysqli_query($conn,$query_departable);

         $counter = 1; // Initialize counter
         while($row_departatble = mysqli_fetch_assoc($result_departable))
            {
          ?>
            <tr>  
            <td><?php echo $counter; ?></td>
            <td>
            <div class='edit' > <?php echo $row_departatble['name'];?></div> 
            <input type='text' class='txtedit' value='<?php echo $row_departatble['name'];?>' id='name_<?php echo $row_departatble['id'];?>' >
            </td>
            <td>
            <div class='edit' > <?php echo $row_departatble['username'];?></div> 
            <input type='text' class='txtedit' value='<?php echo $row_departatble['username'];?>' id='username_<?php echo $row_departatble['id'];?>' >
            </td>
            <td>
            <div class='edit' > <?php echo $row_departatble['email'];?></div> 
            <input type='text' class='txtedit' value='<?php echo $row_departatble['email'];?>' id='email_<?php echo $row_departatble['id'];?>' >
            </td>
            <td>
            <div class='edit' > <?php echo $row_departatble['department id'];?></div> 
            <input type='text' class='txtedit' value='<?php echo $row_departatble['department id'];?>' id='department_<?php echo $row_departatble['id'];?>' >
            <?php echo $row_departatble['department id'];?></td>
            </tr>
            <?php
            }
            $count ++;
            ?>

</tbody>          
    </table>
          </div> 
</div>

update.php

<?php
include('db.php');
if(isset($_POST['field']) && isset($_POST['value']) && isset($_POST['id'])){
   $field = $_POST['field'];
   $value = $_POST['value'];
   $editid = $_POST['id'];
 
    $sql = "UPDATE user SET ".$field."='".$value."' WHERE id = $editid"; 
    $update = $conn->query($sql); 
 
   echo 1;
}else{
   echo 0;
}
exit;
?>

db.php


<?php
// Database configuration
$hostname = "localhost"; // Replace with your host name
$user_name = "root"; // Replace with your database username
$pass_word = ""; // Replace with your database password
$database = "project_ms"; // Replace with your database name

// Establishing the database connection
$conn = mysqli_connect($hostname, $user_name, $pass_word, $database);

// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  exit();
}
?>

browser console

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật