简体   繁体   中英

Is it possible to submit form twice?

I have the situation like updating values to db when form is submitted.Issue here is, Total is calculated only after form is submitted. so i have to update the calculated total again in DB. I need to submit again manually to update it. To achieve this we can use jquery here to form submitted second time with out click it again. Is there quick way to do this ?

Kindly advice ?

You can use ajax to submit form twice, see following code:

function submit() {
  var form = $('#your-form');
  $.ajax({
    type: 'POST',
    url: form.attr('action'),
    data: form.serialize(),
    success: function(data) {
      $.ajax({
        type: 'POST',
        url: form.attr('action'),
        data: form.serialize(),
        success: function(data) {
        }
      });
    }
  });
}

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