jsgrid delete my item before ajax success function

Viewed 607

It is looks like my code:

onItemDeleting: function (args) {
    $.ajax({
        type: "POST",
        url: "/something/asd",
        data: { asd: "cool something" },
        success: function (data) {
            if (data)
                alert("it is something");
            else {
                args.cancel = true;
                alert("something wrong, dude");
            }
        },
        error: function () {
            args.cancel = true;
        },
        dataType: "json"
    });
}

When ajax execute, the delete has done. args.cancel=true; not too effectively, becouse the delete method has done. I need an event driven solution that the delete do not executed before ajax success function.

0 Answers
Related