[Vuejs]-Deleting record using laravel and vue js

0👍

Inside of your method deleteRecord:

this.$http.delete(url)
.success(function(response) {
    console.log(response)
}) 
.error(function(errors) {
    console.log(error)
});

Or using axios inside of your method

axios.delete(url)
.then(function (response) {
    console.log(response);
})
.catch(function (error) {
    console.log(error);
});

0👍

I get it now. I’ll just post it here to help others also.

deleteRecord: function(id) {
  var url = "projects" + "/" + id;
  $.ajax({
      url: url,
      type: 'DELETE',
      data: { "_token": "{{ csrf_token() }}" },
      success: function(response) {
          //do some success stuff here..
      }
  });
}

Leave a comment