class AjaxManager { static async get(type) { let data = { type: type, action: 'get', }; let response = await $.ajax({ type: "POST", url: "save_manager.php", data: JSON.stringify(data), dataType: "json", contentType: "application/json; charset=utf-8", }); console.log(response); return response['data']; } static async delete(id, type) { let data = { type: type, action: 'remove', data: id, }; let response = await $.ajax({ type: "POST", url: "save_manager.php", data: JSON.stringify(data), dataType: "json", contentType: "application/json; charset=utf-8", }); console.log(response); return response['status']; } static async save(data, isNew, type) { let formattedData = { type: type, action: isNew ? 'create' : 'update', data: data, }; console.log(formattedData); let response = await $.ajax({ type: "POST", url: "save_manager.php", data: JSON.stringify(formattedData), dataType: "json", contentType: "application/json; charset=utf-8", }); console.log(response); return response['data']; } }