Create/Edit/Save data in a jQuery pop-up for ASP.NET-MVC and Linq2Sql

我与影子孤独终老i 提交于 2019-12-03 00:50:39

Use AJAX to both send the data from a form in the pop-up (jQuery dialog, really) back to the server and to populate the dialog when you want to do the editing.

$('#addSubcontract').click( function() {
    $.get('/company/new', null, function(data) {
        $('<div>' + data + '</div>').dialog({
            modal: true,
            buttons: {
               'Add': function() {
                        var dialog = $(this);
                        var form = $(this).find('form');
                        $.post('/company/new', $(form).serialize(), function() {
                            dialog.dialog('destroy');
                        }
                      }
               'Cancel': function() {
                      $(this).dialog('destroy');
                      }
           },
           ...
       }
    });
});

I was looking for a solution to this question today.

Found a really nice opensource solution with demo. I figure I'll link it here to save others' time. It's call jQuery Inline Edit.

http://www.codenothing.com/archives/jquery/inline-text-edit/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!