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?
use the . serialize method.
var postData = $('#formId').serialize();
$.post(url, postData);
$("form").submit(function(e) {
e.preventDefault();
$.post("/url", $(this).serialize(), callbackFunction);
});
jquery表单插件是你需要的。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.