0
      $.ajax({
        type: "GET",
        url: "@Url.Action("EditNote", "Home")",
        data: { id: noteId },
        cache: false,
        dataType: "json",
        success: function (mynote) {
            $("#edit-popup").html(mynote.Html);
            $("#edit-popup").dialog({
                resizable: true,
                height: 210,
                width: 510,
                modal: true,
                buttons: {
                    Save: function () {
                        var boxval = $("#edit-content").val();

                        if (!boxval) {
                            showError("Can't save an empty note");
                            return;
                        }
                        $.ajax({
                            type: "POST",
                            url: "@Url.Action("SaveNote", "Home")",
                            data: { id: noteId, content: boxval },
                            cache: false,
                            dataType: "json",
                            success: function (data) {
                                if (data.Message) {
                                    showError(data.Message);
                                } else {
                                    $(liId).replaceWith(data.Html);
                                    $(liId).slideDown("slow");
                                    $("#flash").hide();
                                    $("#edit-popup").dialog("close");
                                }

                            }

                        }); //end save call
                    }, // end ok button
                    Cancel: function () {
                        $("#flash").hide();
                        $(this).dialog("close");
                    }
                },
                close: function () {
                    $("#flash").hide();
                } //end buttons
            }); //end modal edit
        }
    }); //end ajax call

对话框关闭后成功时,我需要它来更新加载的动态内容,我正在使用 replaceWith() 但它不会改变内容,我做错了什么,我真的很陌生。

4

0 回答 0