Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/01/2018, 09:33
sergiodueso
 
Fecha de Ingreso: enero-2011
Ubicación: Zaragoza
Mensajes: 98
Antigüedad: 13 años, 3 meses
Puntos: 1
Problema con sweet alert

Buenas tardes, una pregunta: Porque este código funciona...

Código Javascript:
Ver original
  1. function eliminarImagen(id){
  2.     var url = 'elimina_imagen.php';
  3.     var pregunta = confirm('¿Esta seguro de eliminar esta imagen?');
  4.     if(pregunta==true){
  5.         $.ajax({
  6.         type:'POST',
  7.         url:url,
  8.         data:'id='+id,
  9.         success: function(registro){
  10.             $('#agrega-registros').html(registro);
  11.             return false;
  12.         }
  13.     });
  14.     return false;
  15.     }else{
  16.         return false;
  17.     }
  18. }


Y sin embargo, este otro, cuando subo una foto y la elimino al momento, la pantalla se queda fila. Los botones y enlaces funcionan pero no hace el scroll.
Os pongo el otro código:


Código Javascript:
Ver original
  1. function eliminarImagen(id){
  2.    
  3.     swal({
  4.               title: "¿Eliminar imagen?",
  5.               text: "Se eliminará la imagen completamente",
  6.               type: "warning",
  7.               showCancelButton: true,
  8.               confirmButtonColor: "#DD6B55",
  9.               confirmButtonText: "Si, eliminar",
  10.               closeOnConfirm: true,
  11.               closeOnCancel: true
  12.             },
  13.             function(isConfirm){
  14.                 var url = 'elimina_imagen.php';
  15.                 if (isConfirm) {
  16.                     $.ajax({
  17.                         type: "post",
  18.                         url: url,
  19.                         data: 'id='+id,
  20.                         success: function(registro){
  21.                             swal("¡Eliminado!", "El registro se eliminó correctamente", "success");
  22.                             $('#agrega-registros').html(registro);
  23.                             return false;
  24.                         }
  25.                     });
  26.                     return false;
  27.                 }
  28.             });
  29.  
  30. }

Que es el mismo código pero con sweet alert. No lo entiendo. Gracias.