123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
-
- class AjaxManager {
-
- static async getCategories() {
- let data = {
- type: 'category',
- 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 deleteCategory(id) {
- let data = {
- type: 'category',
- 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 saveCategory(category, isNew) {
- let data = {
- type: 'category',
- action: isNew ? 'create' : 'update',
- data: category,
- };
-
- 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'];
- }
- }
-
-
|