1

まず、ポップアップとダイアログのどちらが正しいウィジェットなのかわかりません。とりあえずポップアップで行きます。フォームがあり、送信時に結果をポップアップに表示したい。検証と JSON の内容は次のとおりです。

$(function(){
    $.fn.serializeObject = function() {
        //serializeObject function stuff
    };

    $(document).on('click', function() {
        $('#myForm').validate({
            errorPlacement: function (error, element) {
                if (element.is('select')) {
                    error.insertAfter(element.parents('div.ui-select'));
                } else {
                    error.insertAfter(element.parents('div.ui-input-text'));  // default placement
                    }
                },
                    errorElement: 'em',
                    submitHandler: function(form){
                    var wrapper = {};
                    var location = {};
                    wrapper.location = $("#newLocation").serializeObject();
                    $.ajax({
                        type: $(form).attr('method'),
                        url: 'server' + 'service' + '/' + 'servicecall',
                        dataType: 'json',
                        async: false,
                        data: JSON.stringify(wrapper),
                        clearform: true,
//****Here is where the fun starts**
                        success: function(msg) {
                                var ID = msg.location.id;
                                //other element ID's...
                                //pop up vars
                                var $popUp = $("<div/>").popup({
                                    dismissable: true,
                                    theme: "d",
                                    overlayTheme: "a",
                                    transition: "pop"
                                }).on("popupafterclose", function () {
                                    $(this).remove;
                                });
                                if(msg.success){
                                    $('#newLocation').slideUp('fast');
                                    $popUp.popup('open').append(ID);
                                 }
                            },
                            error: function(msg) {
                                $popUp.popup('open').append('Error');
                            }
                        });
                        return false;
                    },
                    rules: {
                        //rules
                    },
                    messages: {
                       //messages
                    }
                });
            });

ポップアップを動的に作成し、返されたデータの一部を追加する必要があります。返されたデータを、成功時に表示される非表示の div/テーブルに追加できますが、動的に作成されたポップアップ (またはダイアログが最適な場合) でこれを試みたいと考えています。ポップアップを作成することができません。何か案は?

4

1 に答える 1