Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15257 | Rev 15259 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15257 Rev 15258
Línea 239... Línea 239...
239
                    
239
                    
240
                },
240
                },
241
            },
241
            },
242
            submitHandler: function(form)
242
            submitHandler: function(form)
243
            {
243
            {
244
                $('.btn-primary').attr("disabled", true);
244
                $('#form .btn-primary').attr("disabled", true);
245
                $.ajax({
245
                $.ajax({
246
                    'dataType'  : 'json',
246
                    'dataType'  : 'json',
247
                    'accept'    : 'application/json',
247
                    'accept'    : 'application/json',
248
                    'method'    : 'post',
248
                    'method'    : 'post',
249
                    'url'       :  $('#form').attr('action'),
249
                    'url'       :  $('#form').attr('action'),
250
                    'data'      :  $('#form').serialize()
250
                    'data'      :  $('#form').serialize()
251
                }).done(function(response) {
251
                }).done(function(response) {
252
                    NProgress.start();
252
                    NProgress.start();
253
                    if(response['success']) {
-
 
254
                        $.fn.showSuccess(response['data']);
-
 
255
                        
-
 
256
                        $('#modal').modal('hide');
-
 
257
 
-
 
258
                        
-
 
259
                         gridTable.api().ajax.reload(null, false);
-
 
260
                    } else {
253
                    if(!response['success']) {
261
                        validator.resetForm();
254
                        validator.resetForm();
262
                        if(jQuery.type(response['data']) == 'string') {
255
                        if(jQuery.type(response['data']) == 'string') {
263
                            $.fn.showError(response['data']);
-
 
264
                        } else  {
-
 
265
                            $.each(response['data'], function( fieldname, errors ) {
-
 
266
                                $.fn.showFormErrorValidator('#form #' + fieldname, errors);
256
                            $.fn.showError(response['data']);
267
                            });
257
                            return;
-
 
258
                        }
-
 
259
                          
-
 
260
                        $.each(response['data'], function( fieldname, errors ) {
-
 
261
                            $.fn.showFormErrorValidator('#form #' + fieldname, errors);
-
 
262
                        });
268
                        }
263
                        return;
-
 
264
                    } 
-
 
265
                    $.fn.showSuccess(response['data']);    
-
 
266
                    $('#modal').modal('hide');
269
                    }
267
                    gridTable.api().ajax.reload(null, false);
270
                }).fail(function( jqXHR, textStatus, errorThrown) {
268
                }).fail(function( jqXHR, textStatus, errorThrown) {
271
                   $.fn.showError(textStatus);
269
                   $.fn.showError(textStatus);
272
                }).always(function() {
270
                }).always(function() {
273
                    NProgress.done();
271
                    NProgress.done();
274
                });
272
                });
275
                $('.btn-primary').removeAttr("disabled");
273
                $('#form .btn-primary').removeAttr("disabled");
276
                return false;
274
                return false;
277
            },
275
            },
Línea 278... Línea 276...
278
            invalidHandler: function(form, validator) {
276
            invalidHandler: function(form, validator) {