Ajax的成功不起作用



为什么我在ajax成功上的代码不正常。

查看

$.connection.hub.start().done(function() {
    // Populate the object with values
    $(document).on("click", "#btn_submit_schedule", function () {
        bootbox.confirm({
            title: "Save these details?",
            message: html,
            buttons: {
                confirm: {
                    label: 'YES',
                    className: 'btn-success'
                },
                cancel: {
                    label: 'NO',
                    className: 'btn-danger'
                }
            },
            callback: function (result) {
                if (result === true) {
                    $.ajax({
                        type: 'POST',
                        url: '/Member/CreateTicket',
                        data: obj,
                        succes: function (controlResult) {
                            console.log(controlResult);
                            if (controlResult === true) {
                                $.notify({
                                    icon: 'glyphicon glyphicon-star',
                                    message: "Ticket has been saved"
                                }, {
                                    animate: {
                                        enter: 'animated bounceIn',
                                        exit: 'animated bounceOut'
                                    }
                                }, {
                                    type: 'success'
                                });
                                $("#create_ticket_status").html("Created ticket successfully.");
                                chat.server.getPendingRequestCount(document.getElementById("selected_id").value);
                            } else {
                                $("#create_ticket_status").html(result);
                                $.notify({
                                    icon: 'glyphicon glyphicon-star',
                                    message: "An error has occured on creating the ticket"
                                }, {
                                    animate: {
                                        enter: 'animated bounceIn',
                                        exit: 'animated bounceOut'
                                    }
                                }, {
                                    type: 'success'
                                });
                            }
                        },
                        error: function() {
                            $.notify({
                                icon: 'glyphicon glyphicon-star',
                                message: "Error has occured in creating ticket."
                            }, {
                                animate: {
                                    enter: 'animated bounceIn',
                                    exit: 'animated bounceOut'
                                }
                            }, {
                                type: 'success'
                            });
                        }
                    });
                } 
            }
        });
    });
});

控制器

[HttpPost]
public ActionResult CreateTicket(CreateTicket ticket)
{
    if (ModelState.IsValid)
    {
        var tm = new TicketManager();
        var controlResult = tm.CreateTicket(ticket);
        return controlResult ? Json(true) : Json("An error occured on creating the ticket.");
    }
    return Json("Fill-in the required fields.");
}

我实际上可以在检查器的"依据"选项卡中看到结果,并且可以保存在数据库中。为什么成功函数不起作用,超出了我。如果我故意创建错误,我可以看到我的错误函数有效。你能指出我做错了什么吗?

有一个错字

成功:function(control result){

您可以对其进行纠正,然后尝试成功 double s

相关内容

最新更新