且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery的AJAX提交表单

更新时间:2022-12-11 14:41:36

您可以使用当作ajaxForm / ajaxSubmit的功能从 Ajax表格插件一>或jQuery的序列化功能。

You can use the ajaxForm/ajaxSubmit functions from Ajax Form Plugin or the jQuery serialize function.

当作ajaxForm

$("#theForm").ajaxForm({url: 'server.php', type: 'post'})

$("#theForm").ajaxSubmit({url: 'server.php', type: 'post'})

当作ajaxForm将发送时提交按钮是pressed。 ajaxSubmit会立即发送。

ajaxForm will send when the submit button is pressed. ajaxSubmit sends immediately.

序列化

$.get('server.php?' + $('#theForm').serialize())

$.post('server.php', $('#theForm').serialize())

AJAX序列化文档这里