3👍
✅
You definitelly need to prevent the browser from submiting the form. <form v-on:submit.prevent="handleSubmit">
should be the way to go.
In your handleSubmit
method, you need to use a HTTP request in the background to talk to your API. Axios is a very popular solution you may want to take a look at.
There are plenty of libraries to solve this, depending on your needs. I’d
go with axios, as it is widely known and used, so it is easy to find
good tutorials and help with that. You could in fact use standard XMLHttpRequest
as well, but that is not your best option when using Vue.js.
Source:stackexchange.com