Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let vm = new Vue({
- el: "#container",
- data: {
- newPerson: {
- firstName: '',
- lastName: ''
- }
- },
- methods: {
- sendIdentity: async function() {
- try {
- const {data} = await axios.post('https://www.petario.com/test.php', this.newPerson);
- console.log(data);
- } catch(e) {
- console.log(e);
- }
- },
- toFormData: function(obj) {
- let formData = new FormData();
- for(let key in obj) {
- formData.append(key, obj[key]);
- }
- return formData;
- }
- }
- });
Add Comment
Please, Sign In to add comment