Php SweetAlert2表单提交确认不使用Codeigniter

Php SweetAlert2表单提交确认不使用Codeigniter,php,jquery,sweetalert2,Php,Jquery,Sweetalert2,我试图在用户使用CodeIgniter提交表单之前弹出一个确认窗口,但触发器/提交部分不起作用。它要求确认,但没有提交表单 我的HTML: <?php echo form_open(site_url("action"), array('id' => "order" , )) ?> <input type="text" class="form-control" name="anything" value=""> <button type="submit" id=

我试图在用户使用CodeIgniter提交表单之前弹出一个确认窗口,但触发器/提交部分不起作用。它要求确认,但没有提交表单

我的HTML:

<?php
echo form_open(site_url("action"), array('id' => "order" , )) ?>
<input type="text" class="form-control" name="anything" value="">
<button type="submit" id="btn-submit" class="btn btn-danger" class="form-control">Submit</button>
<?php echo form_close() ?>
我也尝试过选择表单id按钮,但同样的问题。资源已正确加载。

更改它:

var form = $(this).parents('form');


然后再试一次。

我实际上使用了错误的函数。我在加载sweetalert2时使用的函数来自sweetalert。我把代码从

swal({
  {... closeOnConfirm: false},
  function() {
   // Function
  }
});


它正在工作

看起来我的版本不对!我会在这里更新。
var form = $(this).parent('form');
swal({
  {... closeOnConfirm: false},
  function() {
   // Function
  }
});
swal({
  ...
  showLoaderOnConfirm: true,
  preConfirm: function() {
    //function
}).then(function() {
  swal('Processing');
});