整个传递形式,jQuery中的Ajax功能的数据 [英] Pass entire form as data in jQuery Ajax function

查看:141
本文介绍了整个传递形式,jQuery中的Ajax功能的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jQuery的AJAX功能,并希望整个形式发布数据。我们正在不断更新的形式,使其成为乏味的不断更新,应该在查询中发送的表单输入。

I have a jQuery ajax function and would like to an entire form as post data. We are constantly updating the form so it becomes tedious to constantly update the form inputs that should be sent in the query.

推荐答案

还有一个功能,正是这一点:

There's a function that does exactly this:

http://api.jquery.com/serialize/

var data = $('form').serialize();
$.post('url', data);

这篇关于整个传递形式,jQuery中的Ajax功能的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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