当我点击确定swal按钮时如何重新加载?

时间:2016-09-29 13:34:03

标签: javascript jquery html

enter image description here

$.ajax({
  type: "POST",
  url: "php/register.php",
  data: datas,
}).done(function(data) {
  swal(data),
    function() {
      location.reload();
    }
});

当我点击swal按钮上的确定时如何重新加载? 这是我的代码。

1 个答案:

答案 0 :(得分:2)

回调函数应传递给swal。您当前正在函数调用之外定义它。

swal( data, function() {
   location.reload();
});

Demo