Level 70
You need to use axios for that. Use cdn for axios.
this.$http.post(Pass your params).then((response) => {
}, (response) => {
// error callback
});
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I've been struggling to find a way to submit a form in Vue. In Jquery, I can use form id and submit like so.
$( "#target" ).submit();
How can I do that in Vue? for example, here's my opening form.
<form ref:form="" method="POST" action="admin/item" accept-charset="UTF-8" role="form" id="form-create" class="form-horizontal">
Thanks!
@tisuchi @lars6 Pretty sure OP just wants to submit the form from something like a button outside, not do an Ajax request.
OP:
document.querySelector('#myform').submit(); // will do the same as $('#myform').submit();
// or if you want to do an Ajax request, follow what the other users have done above
Please or to participate in this conversation.