layui add functionality

  

case 'add':
                layer.open({
                    type : 1,
                    title: "Add page"
                    area: [ '580px', '640px'], // set the width and height of the pop-up page
                    offset: '20px', // set the relative position (offset)
                    content: $ ( "# add_project"), where the ID // form, simply means that you want to fill in the input box, etc.
                    cancel : function() {
                        What // After you click on the top right to do X Cancel
                        setTimeout ( 'window.location.reload ()', 1); // X Click the upper right corner to close the page. Then refresh the page;
                        
                    },
                    success: function () {// callback
                        $(':input', '#add_project').not(':button,:submit,:hidden,:radio').val('').removeAttr('checked').removeAttr('selected'); 
                        form.render (); // re-rendering
                        After form.on ( 'submit (submitUpdProject)', function () {// Click Submit callback;
                            was jsonEntity = {};
                            var entity = $("form").serializeArray()
                            $.each(entity, function() {
                                if (this.name == "createTime") {
                                    var a = new Date();
                                    jsonEntity[this.name] = timeDate(a);
                                } else {
                                    jsonEntity[this.name] = this.value;
                                }
                            });

                            zsg (_url, jsonEntity); // url is the path, the path of the call back method
                            setTimeout ( 'window.location.reload ()', 1000); // refresh the page
                            layer.closeAll();
                            return false;
                        });

                    }
                });
                break;

 

Guess you like

Origin www.cnblogs.com/a973692898/p/11691973.html