JavaScript Sweet alert redirects before the user clicks OK sweet alert redirect after click ok,sweet alert redirect on

I'm using SweetAlert2 and the 7th example on this page:

Go to 7th example below to see it in action

this one:

    swal({
        title: 'Are you sure?',
        text: 'You will not be able to recover this imaginary file!',
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Yes, delete it!',
        closeOnConfirm: false
    },
    function() {
        swal(
          'Deleted!',
          'Your file has been deleted.',
          'success'
        );
    });

like this:

function deleteEvent(id)
{
    swal({
        title: 'Are you sure?',
        text: 'You will not be able to recover this event!',
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Yes, delete it!',
        closeOnConfirm: false
    }).then(function() {
        swal(
          'Deleted!',
          'Your event has been deleted.',
          'success'
        );
            $.ajax({
                url: '/events/'+id,
                type: "DELETE",
                data:{ _token: "{{csrf_token()}}" },
                success: function() {
                    location.href = '/events';
                }
            });
    });
}

But when the user clicks the confirm button to delete....this popup enter image description here

goes right away because of my redirect and the user doesn't even get the chance to click the OK button...

How can i make the redirect AFTER the user clicks the OK on this image?

Answer:1

I'd like to achieve this effect via css and possibly jQuery. That is to create a search bar that is hidden, and will nicely slide to the left on clicking the search icon in the label. But I just ...

I'd like to achieve this effect via css and possibly jQuery. That is to create a search bar that is hidden, and will nicely slide to the left on clicking the search icon in the label. But I just ...

I am using the FullCalendar plugin for my calendar. I am trying to loop through some ajax data I have acquired and populate my calendar with the relevant fields I want to use. This is what i'm doing:...

I am using the FullCalendar plugin for my calendar. I am trying to loop through some ajax data I have acquired and populate my calendar with the relevant fields I want to use. This is what i'm doing:...

  1. jquery fullcalendar eventclick
  2. jquery fullcalendar eventclick get date
  3. jquery fullcalendar trigger event click
  4. jquery fullcalendar event click not working
  5. jquery fullcalendar event right click
  6. fullcalendar eventclick

I have a route like this path: 'projects/:id/settings' And in my header.component.html I want to have a link to this page <a routerLink="['projects', progectId,'settings']" routerLinkActive="...

I have a route like this path: 'projects/:id/settings' And in my header.component.html I want to have a link to this page <a routerLink="['projects', progectId,'settings']" routerLinkActive="...

  1. angular router link active
  2. angular router link not working
  3. angular router link button
  4. angular routerlink example
  5. angular router link params
  6. angular routerlink with data
  7. angular routerlink new tab
  8. angular router link conditional
  9. angular router link with query params
  10. angular router link on click
  11. angular router link disable
  12. angular router link reload page
  13. angular router link go back
  14. angular routerlink to parent
  15. angular router link state
  16. angular router link active class
  17. angular routerlink variable
  18. angular router link relative path
  19. angular routerlink anchor tag
  20. angular router link active css

I would like to clear the textarea content after enter key press on react. However when enter key press the text area clears but the enter key remains (new line). How can I fix this? constructor(){ ...

I would like to clear the textarea content after enter key press on react. However when enter key press the text area clears but the enter key remains (new line). How can I fix this? constructor(){ ...

  1. clear textarea after submit
  2. clear textarea after submit react
  3. clear textarea after submit angular
  4. clear textarea after enter
  5. clear textarea after submit ajax
  6. clear textarea after submit angularjs
  7. clear textarea after submission
  8. javascript clear textarea after submit
  9. php clear textarea after submit
  10. jquery clear textarea after enter
  11. clear textarea value after click