2017-08-16 135 views
0

我有一個SweetAlert 2問題,我試圖在用戶單擊好時提交表單。SweetAlert 2 - 表單提交(超出最大調用堆棧大小)

代碼是如下(使用jQuery)

$('#sa-params').click(function(e) { 
     e.preventDefault(); 
     e.stopPropagation(); 
     swal({ 
      title: 'Are you sure?', 
      text: "You won't be able to revert this!", 
      type: 'warning', 
      showCancelButton: true, 
      confirmButtonColor: '#3085d6', 
      cancelButtonColor: '#d33', 
      confirmButtonText: 'Yes, delete it!', 
      cancelButtonText: 'No, cancel!', 
      confirmButtonClass: 'btn btn-success', 
      cancelButtonClass: 'btn btn-danger', 
      buttonsStyling: false 
      }).then(function() { 
      swal(
       'Deleted!', 
       'It has been deleted, FOREVER!', 
       'success' 
      ) 
      $('form#delete-form').submit(); 
      }, function (dismiss) { 
      if (dismiss === 'cancel') { 
       swal(
       'Cancelled', 
       'Relax, nothing has been deleted :)', 
       'error' 
      ) 
      } 
      }) 
      return false; 
    }); 

獲得一個下面的JavaScript錯誤:

Uncaught (in promise) RangeError: Maximum call stack size exceeded 

主要的東西,如果我有console.log('success')錯誤更換表單提交沒有顯示。

根據bower.json:

jQuery version is: 2.2.4

SweetAlert2 version is: 5.3.8

+0

尼特:更新你的SweetAlert2依賴到[^ 6.0.0](https://github.com/limonte/sweetalert2/releases/tag/v6.0.0),只有一個insignifi不能改變。 –

回答

1

$('form#delete-form')[0].submit();

解決我的問題,我不知道爲什麼我還沒有試過......

相關問題