【发布时间】:2018-12-24 04:26:52
【问题描述】:
只是想知道是否可以从 Html 表单元素序列化数据,然后使用 Axios 的发布请求发布数据。
下面的代码显示了在单击按钮以提交帖子时触发的事件。
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">
是序列化一个选项还是我必须手动设置每个值?
【问题讨论】:
标签: javascript html laravel post axios