更新时间:2022-12-11 13:35:36
您可以使用 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 将在提交按钮被按下时发送.ajaxSubmit 立即发送.
ajaxForm will send when the submit button is pressed. ajaxSubmit sends immediately.
序列化:
$.get('server.php?' + $('#theForm').serialize())
$.post('server.php', $('#theForm').serialize())