1

this is my sweetalert I want to update my database STATUS column when I click this confirm button plz help me thanks

swal({
    title: 'Are you sure?',
    text: "You won't be able to revert this!",
    type: 'warning',
    showCancelButton: true,
    confirmButtonColor: '#228B22',
    cancelButtonColor: '#d33',
    confirmButtonText: 'Yes, confirm it!'
}).then(function () {
swal(
    'Confirmed!',
    'success'
)
})
m fernando
  • 19
  • 7

1 Answers1

0

You can write your code in callback function

Check below code

swal({
  title: 'Are you sure?',
  text: "You won't be able to revert this!",
  type: 'warning',
  showCancelButton: true,
  confirmButtonColor: '#228B22',
  cancelButtonColor: '#d33',
  confirmButtonText: 'Yes, confirm it!'
}).then(function () {

  // write your code in the response of ajax call
  $.ajax({
    url:"",
    success:function(resp){
      swal('Confirmed!','success')
    }
  });
})
Ashish Rana
  • 157
  • 1
  • 10