var app = new Vue({ el: '#app', data: { config: { released_episode: 80, last_diorama: 50, available_dioramas: 0, first_diorama: 6, github_levels: [], github_episodes: [], github_success: false, github_access_token: "ac4311edd3cc5acf4ccc321525a96a", }, }, mounted: function () { }, watch: { }, computed: { test: function () { }, } }) function getData() { var xhr = new XMLHttpRequest(); var url = "http://localhost:8000"; console.log("url", url); xhr.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { var response = JSON.parse(this.responseText); app.config.github_episodes = response; app.config.github_success = true; console.log(xhr.responseText); } }; xhr.open("GET", url, true); xhr.send(); } function setData() { var newName = 'John Smith', xhr = new XMLHttpRequest(); xhr.open('POST', 'http://localhost:8000/set'); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onload = function() { console.log(xhr.responseText); }; xhr.send(encodeURI('name=' + newName)); }