不要输入submit()函数

时间:2019-06-03 21:53:27

标签: javascript php jquery html

我正在尝试执行通过AJAX发送表单但不输入表单的.submit函数的函数。我在做什么错了?

那是我的代码。

$(document).ready(function() {
  debugger;
  console.log('doc'); // Enter here!
  $('#formClient').submit(function() {
    console.log('submit'); // Not enter here!
    // var dados = jQuery( this ).serialize();
    // $.ajax({
    //     type: 'POST',
    //     url: '../client/clientRegisterEdit.php',
    //     data: dados,
    //     success: function(data){
    //         alert(data);
    //     }
    // });
    // return false;
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="<?php //echo urlClientRegisterEdit ?> " method="post" id="formClient" name="formClient" onsubmit="">
  <div class="row">
    <div class="col-12 col-sm-12 col-md-12 col-lg-12">
      <button type="submit" class="btn btn-success">
                    <i class="fa fa-save"></i> Salvar
                 </button>
    </div>
  </div>
  <div class="row">
    <div class="col-12 col-sm-12 col-md-12 col-lg-3">
      <div class="form-group">
        <label for="">Código:</label>
        <input type="text" class="form-control" name="code" id="code" aria-describedby="helpId" placeholder="">
        <!-- Others inputs here-->
      </div>
    </div>
  </div>
</form>

0 个答案:

没有答案