甜蜜警报(我想更新数据库状态(默认值:待定)进入确认,当我点击甜蜜警报确认按钮

时间:2017-10-09 04:26:03

标签: php jquery mysql codeigniter

这是我的sweetalert我想更新我的数据库STATUS列,当我点击这个确认按钮时PLZ帮帮我谢谢

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'
)
})

1 个答案:

答案 0 :(得分:1)

您可以在回调函数中编写代码

检查以下代码

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')
    }
  });
})