submit the form using ajax

后端 未结 8 890
栀梦
栀梦 2020-12-05 10:17

I\'m developing an application (a kind of social network for my university). I need to add a comment (insert a row in a specific database). To do this, I have a HTML form in

8条回答
  •  爱一瞬间的悲伤
    2020-12-05 10:48

    What about

    $.ajax({
      type: 'POST',
      url: $("form").attr("action"),
      data: $("form").serialize(), 
      //or your custom data either as object {foo: "bar", ...} or foo=bar&...
      success: function(response) { ... },
    });
    

提交回复
热议问题