J
J
jekanok2019-01-10 17:36:00
Vue.js
jekanok, 2019-01-10 17:36:00

Why is the json file not parsed via http, or locally?

new Vue({
  el: '#app',
  data() {
    return {
      info: null
    };
  },
  mounted() {
    axios
      .get('http://likser.ru/tickets.json')
      .then(response => (this.info = response));
  }
});


<html>
    <head>
        <link rel="stylesheet" href="index.css">
        <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    </head>
    <body>
        <div id="app">
            {{info}}
        </div>
        <script src="index.pack.js"></script>
    </body>
</html>

why not parse?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shvets2, 2019-01-10
@shvets2

Try `this.info = response.data`. And it would also be nice to add `catch()` with an error output. To check, add the output of the received data (at least `console.log(response.data)` in the `then()` block).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question