Quantcast
Viewing all articles
Browse latest Browse all 43

Answer by HMR for Error Posting in Asp.Net Core with Vue.JS and Axios

I'm not 100% sure but think this.data is undefined according to the example here. You could try the following:

methods:{  submitInfo(){      axios.post("Employees/Create",        {          Firstname: this.Firstname,          Lastname: this.Lastname        }      )      .then(function(response){...})      .catch(function(error){...});  }}

Or a simpler method according to this documentation:

methods:{  submitInfo(){      axios.post("Employees/Create",        this.$data      )      .then(function(response){...})      .catch(function(error){...});  }}

If that doesn't work for you then you can debug the page by opening the developer console in the browser (press F12) and debug on the line to inspect the value of this:

methods:{  submitInfo(){      debugger;//it should break here, use the console to see what this is      axios.post("Employees/Create",        this.$data      )      .then(function(response){...})      .catch(function(error){...});  }}

Viewing all articles
Browse latest Browse all 43

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>