How to AJAX more than one form on the same page

后端 未结 4 1362
不知归路
不知归路 2021-01-29 05:58

I had a form that when I clicked on submit it was submitted. Then that form hid and the result of action page showed in div with classname=dig.

It was worki

4条回答
  •  伪装坚强ぢ
    2021-01-29 06:30

    $(".done").click(function(e) {
       var dig=$(this).parents('.dig');
      var url = 'http://seller.ir/test'
      $.ajax({
        type: "POST",
        url: url,
        data: $(this).parent('.formi').serialize(),
        success: function(data) {
          $(dig).empty()
    
          $(dig).html(data)
        }
      });
      e.preventDefault();
    });
    

提交回复
热议问题