text: // Make sure we wait to attach our handlers until the DOM is fully loaded.
  $(function () {
      $(".change-devour").on("click", function (event) {
          event.preventDefault();
          event.stopPropagation();
          var id = $(this).data("id");
          var newDevour = $(this).data("devoured");
  
          var devouredState = {
              devoured: newDevour
          };
  
          // Send the PUT request.
          $.ajax("/api/burgers/" + id, {
              type: "PUT",
              data: devouredState
          }).then(function () {
              console.log("Devoured burger");
              location.reload();
          })
          // .then(
          //     function () {
          //         console.log("changed devour to", newDevour);
          //         // Reload the page to get the updated list
          // location.reload();
          //     }
          // ).catch(function(error) {
          //     console.log(error);
          // });
      });
  
      $(".create-form").on("submit", function (event) {
          // Make sure to preventDefault on a submit event.
          event.preventDefault();
  
          var newBurger = {
              name: $("#burger").val().trim(),
          };
  
          // Send the POST request.
          $.ajax("/api/burgers", {
              type: "POST",
              data: newBurger
          }).then(
              function () {
                  console.log("created new burger");
                  // Reload the page to get the updated list
                  location.reload();
              }
          );
      });
  
      // $(".delete-burger").on("click", function(event) {
      //   var id = $(this).data("id");
  
      //   // Send the DELETE request.
      //   $.ajax("/api/burgers/" + id, {
      //     type: "DELETE"
      //   }).then(
      //     function() {
      //       console.log("deleted burger", id);
      //       // Reload the page to get the updated list
      //       location.reload();
      //     }
      //   );
      // });
  });
  