Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

80
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!