Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {{ parent() }}
- <div class="modal fade" id="largeModal" tabindex="-1" role="dialog">
- <div class="modal-dialog modal-lg" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h4 class="modal-title" id="largeModalLabel">AGREGAR USUARIO</h4>
- </div>
- <div class="modal-body">
- {{ form_start(form, {'action': path("usuario_insertar"), 'method': 'POST', 'attr': {'id': 'formModal'}}) }}
- <div class="row clearfix">
- <div class="col-lg-3 col-md-3 col-sm-3 col-xs-6">
- <div class="form-group form-float">
- <div class="form-line">
- {{ form_widget(form.nombre, {'attr': {'class': 'form-control', 'id': 'nombre' }}) }}
- {{ form_label(form.nombre, 'Nombre', {'label_attr': {'class': 'form-label'}}) }}
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button type="submit" class="btn btn-default waves-effect ">Agregar</button>
- <button type="button" class="btn btn-danger waves-effect" data-dismiss="modal">Cancelar</button>
- </div>
- {{ form_end(form) }}
- </div>
- </div>
- </div>
- //INSERTAR USUARIO CON MODAL
- <script type="text/javascript">
- $(document).ready(function(){
- jQuery(function($) {
- $('#formModal').on('submit', function() {
- var nombre = $('#nombre').val();
- var apellidos = $('#apellidos').val();
- var email = $('#email').val();
- var CI = $('#CI').val();
- var username = $('#username').val();
- var password = $('#password').val();
- var rol = $('#rol').val();
- var data = {nombre: nombre, apellidos: apellidos, email: email, CI: CI, username: username, password: password, rol: rol};
- console.log(data);
- $.ajax({
- //url: $(this).attr('action'),
- //type: $(this).attr('method'),
- //data: $(this).serialize()
- url: '{{ path('usuario_insertar') }}',
- type: 'post',
- data: data,
- success: function(data){
- $('#largeModal').modal('hide');
- },
- error: function(){ alert("Ha ocurrido un error.")}
- });
- return false;
- });
- });
- });
- </script>
Add Comment
Please, Sign In to add comment