JSON on page (from a URL)

Hello, I’m trying to add JSON data on the page from a URL but im not really sure how I need to add it in the right way. I already saw the page https://framework7.io/docs/request.html

I wanted to add it in export defaults{} but I dont know how? Is there any documentation how to do it? Or how to add it in app.js and then on a page?

I tried with this code, but doesnt work. Sorry for the noob question… and thanks in advance

<template>
  <div class="page" data-name="user">
<div class="navbar">
  <div class="navbar-bg"></div>
  <div class="navbar-inner sliding">
    <div class="left">
      <a href="#" class="link back">
        <i class="icon icon-back"></i>
        <span class="if-not-md"></span>
      </a>
    </div>
    <div class="title">User</div>
  </div>
</div>
<div class="page-content">
  {{username}}
</div>
  </div>
  </template>
  <script>
  export default { 
app.request.get('https://jsonplaceholder.typicode.com/users', function (data) {
console.log(data);
})  ;
  };
<template>
  <div class="page" data-name="user">
    <div class="navbar">
      <div class="navbar-bg"></div>
      <div class="navbar-inner sliding">
        <div class="left">
          <a href="#" class="link back">
            <i class="icon icon-back"></i>
            <span class="if-not-md"></span>
          </a>
        </div>
        <div class="title">User</div>
      </div>
    </div>
    <div class="page-content">
      {{username}}
    </div>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        users: [],
      };
    },
    on: {
      pageInit() {
        this.$app.request.get('https://jsonplaceholder.typicode.com/users', function (data) {
          console.log(data);
        })
      },
    }
  };
</script>
1 Like

thank you really much. Now i can see better how to do it!

Look this play list.

Framework7 2020 tutorial: https://www.youtube.com/[email protected]

the url doesn’t work, can you send it again?