想知道是否可以将从Html表单元素序列化的数据,然后使用Axios进行post请求发送数据。
以下是代码,展示了当点击按钮提交post时触发的事件。
function form_submission(e)
{
var data = document.getElementById('venueForm');
axios.post('/venue/', {
})
.then (function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
}
以下是选择数据的html代码示例:
<form method="POST" action="http://core-site.test/venue/{{$venue->slug_field}}" accept-charset="UTF-8" id="venueForm">
序列化是否可选,还是我必须手动设置每个值?