Skip to content

createDataProcessor #62

@WojakGra

Description

@WojakGra
scheduler.createDataProcessor({
        event: {
            create: function (data) {
                console.log(data);
                return new scheduler.Promise(function (resolve, reject) {
                    $.post(
                        "api.php",
                        { action: "test", data: data },
                        function (result) {
                            return resolve({
                                action: result.action,
                                tid: result.tid,
                                data: result.task,
                            });
                        },
                        "json"
                    );
                });
            },
            update: function (data, id) {
                console.log(data);
                console.log(id);
                return new scheduler.Promise(function (resolve, reject) {
                    $.post(
                        "api.php",
                        { action: "test", data: data },
                        function (result) {
                            return resolve({ action: result.action });
                        },
                        "json"
                    );
                });
            },
            delete: function (id) {
                console.log(id);
                return new scheduler.Promise(function (resolve, reject) {
                    $.post(
                        "api.php",
                        { action: "test", data: id },
                        function (result) {
                            return resolve({ action: result.action });
                        },
                        "json"
                    );
                });
            },
        },
        mode: "JSON",
    });

Upper code not working as intentended because is shows a console error

ajax.js:219          POST http://localhost/calendar/undefined 404 (Not Found)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions