Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

csesumonpro's avatar

How to Render Vue js in HTML File

I have already created a html file with support vue axios and vue js java script file. When send a get request for data. Request properly success because i have already checked in console log. How to render in html file without using Curly bracket.

0 likes
4 replies
csesumonpro's avatar

I have already checked it, does not work. I want to know to retrieve value from axios request using html file. not laravel blade file . only html file. get axios request value just i use curly bracket from retrieve value.

burlresearch's avatar
<template>
  // html
  <ul v-if="udata">
    <li> {udata.name}} </li>
  </ul>
</template>

// Performing a GET request in Vue methods:
axios.get('https://api.example.com/data')
  .then(function(response){
    console.log(response.data); // ex.: { user: 'Your User'}
    console.log(response.status); // ex.: 200

    this.udata = response.data.user
  });  
tykus's avatar

You need to assign the result of the Axios request to a property on your Vue data:

data () {
    return {
        your_property: ‘’
    }
}
methods:{
    getData () {
         axios.get().then(({data}) => this.your_property = data)
    }
}
1 like

Please or to participate in this conversation.