$(document).ready(function () { refresh(); userinfo(); $.ajax({ type: "POST", url: "/group", data: { sl_id: "0", name: "testgroup", color: "orangered", hidden: false } }); $(".btn_invite").click(function () { $.ajax({ type: "POST", url: "/invite", data: { sl_id: 'gKrNZiA3' } }); }); $(document).on("click", ".btn_detail", function () { window.location.replace("/shoppinglist_json/" + $(this).closest("tr").attr("id")); }); $(".btn_add").click(function () { $.ajax({ type: "POST", url: "/shoppinglist", data: { name: $(".name").val(), description: $(".description").val(), color: "red" }, success(result) { refresh(); } }); }); $(document).on("click", ".btn_delete", function () { $.ajax({ type: "DELETE", url: "/shoppinglist", data: { sl_id: $(this).closest("tr").attr("id") }, success(result) { refresh(); } }); }); }); function refresh() { $("tbody").empty(); $.ajax({ type: "GET", url: "/myshoppinglists", success(data) { for (let item of data) { $(".tb_myshoppinglists").append("