简体   繁体   中英

I have prevented form submission using jquery. How Can I submit form again without removing my current code?

I have prevented form submission using jquery. How Can I submit form again without removing my current code ?

$(".form-horizontal").submit(function (e) {
  e.preventDefault();
 });

Using Js

$('.form-horizontal').get(0).submit()

OR Using Flag

var preventForm = true;
$(".form-horizontal").submit(function(e) {
  if (preventForm) {
    e.preventDefault();
  }
});

Set preventForm = false before you submit

没有进一步的上下文很难回答,但您可以向提交按钮添加一个单击处理程序,该按钮将 http 请求发送到表单端点。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM