How to post a form with many fields with jQuery?

后端 未结 7 2407
不知归路
不知归路 2020-12-15 06:46

Though $.ajax() can be used to do ajax things, I don\'t think its fit for posting values of a big form.

How would you post a big form (many fields) with

7条回答
  •  再見小時候
    2020-12-15 07:33

    You probably want to use serialize if you don't want to manually deal with each element.

    $.ajax({
       type: "POST",
       url: "form.php",
       data: $("#form_id").serialize()
       success: function(msg) {
         alert("Form Submitted: " + msg);
       }
     });
    

提交回复
热议问题