Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

81
Vistas
jquery-confirm confirmation popup disapearance problem

I have a list of employees and each has a delete operation button and i am using jquery-confirm.js library but when i click delete button confirmation popup appears and immediately disappears after a few seconds without clicking any button. here is the js code of the pop up

  $('.deleteBtn').on('click',function () {
    $.alert({
        title: 'تایید حذف',
        content: 'آیا میخواهید این کارمند حذف شود؟',
        rtl: true,
        closeAnimation: 'scale',
        useBootstrap:true,
        closeIcon: true,
        buttons: {
            confirm: {
                text: 'تایید',
                btnClass: 'btn-blue',
                action: function () {
                    $.alert('تایید شد.');
                }
            },
            cancel: {
                text: 'انصراف',
                action: function () {
                }
            }
        }
    });
});

and here is the delete button:

<td><a href="{{route('employee.delete',$employee->id)}}" class="deleteBtn"><i class="icon-trash"></i></a></td>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

When you click on this button it goes to that route and refreshes the page, you should use ajax like below change your button to:

<a id="{{$employee->id)}}" class="deleteBtn"><i class="icon-trash"></i></a>

and your js code:

$('.deleteBtn').on('click',function () {

let id = $(this).attr('id');
$.alert({
    title: 'تایید حذف',
    content: 'آیا میخواهید این کارمند حذف شود؟',
    rtl: true,
    closeAnimation: 'scale',
    useBootstrap:true,
    closeIcon: true,
    buttons: {
        confirm: {
            text: 'تایید',
            btnClass: 'btn-blue',
            action: function () {
              
            $.ajax({
                type: "get",
                url: "{{route('employees.delete')}}",
                data: {
                    'id': id
                },
                success: function (msg) {
                    alert('انجام شد!')

                   
                }
            });
            }
        },
        cancel: {
            text: 'انصراف',
            action: function () {
            }
        }
    }
});
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda