admin管理员组文章数量:1399968
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 mand to send it?
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 mand to send it?
Share Improve this question edited Jul 29, 2009 at 20:47 Matthew Groves 26.2k10 gold badges73 silver badges125 bronze badges asked Jul 29, 2009 at 19:44 Tony BorfTony Borf 4,6709 gold badges45 silver badges52 bronze badges3 Answers
Reset to default 10use the .serialize method.
var postData = $('#formId').serialize();
$.post(url, postData);
$("form").submit(function(e) {
e.preventDefault();
$.post("/url", $(this).serialize(), callbackFunction);
});
jquery form plugin is what you need.
本文标签: javascriptJquery post and form dataStack Overflow
版权声明:本文标题:javascript - Jquery .post and form data - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744233151a2596434.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论