Vue Fetch(url)

In your previous Vue component. Add the following code in the mounted() life cycle event to send an Ajax request when the component is mounted.
fetch(“http://jsonplaceholder.typicode.com/todos”).then(function (response) {
return response.json();
}).then(function (result) {
this.todos = result;
});

fetch(‘https://jsonplaceholder.typicode.com/todos’, { method: ‘POST’, body:JSON.stringify({title:“a new todo”}) }).then((res) => res.json()) .then((data) => console.log(data)) .catch((err)=>console.error(err))