Jquery .post和表单数据 [英] Jquery .post and form data

查看:91
本文介绍了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和表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆