本文介绍了Jquery .post和表单数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.post将我的数据发布到我的控制器。我想传递我在表单中的所有数据。是否有一种简单的方法来获取所有表单数据并将其添加到.post命令以发送它?

I am using .post to post my data to my controller. I would like to pass all the data that I have in a form. Is there an easy way to take all the form data and add it to the .post command to send it?

推荐答案

使用。方法。

var postData = $('#formId').serialize();
$.post(url,  postData);

这篇关于Jquery .post和表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 17:45
查看更多