Submitting a jQuery ajax form with two submit buttons

前端 未结 8 1036
花落未央
花落未央 2020-12-05 07:31

I have a form that looks like this:

8条回答
  •  天命终不由人
    2020-12-05 08:15

    Without resorting to the Form plugin (which you should use) you should be handling the submit event instead. The code would stay pretty close to the original:

    $("form").submit(function()) {
      $.post($(this).attr("action"), $(this).serialize(), function(data) {
        // work with the response
      });
      return false;
    });
    

提交回复
热议问题