How to Get Data From mysql using VueJs and PHP

How to Get Data From mysql using VueJs and PHP

In this Post We Will Explain About is How to Get Data From mysql using VueJs and PHP With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to How to get data from mysql using VueJS and PHPExample

In this post we will show you Best way to implement how to fetch data from database using Vuejs in html, hear for how to fetch data from database using Vuejswith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  laravel 5.8 change date format using carbon example

Syntex of Vuejs Fetch Data

new Vue({
    el: '#liveapp',

    data: {
        data_msg: []
    },

    ready: function() {
      this.get_fetchmsg();
    },

    methods: {
        get_fetchmsg: function() {
            this.$http.get('/customers/list/data', function(data_msg) {
                alert(data_msg);
                this.$set('data_msg', data_msg);
            });
        }
    }
});

How to get data from mysql using Vuejs and PHP

// Simple GET request
this.$http({url: 'https://infinityknow.com/api/index.php', method: 'GET'}).then(function (result) {
    //Simple success callback
}, function (result) {
    //Simple error callback
});

Data fetching from database using laravel and vuejs

index.html

var data = [{
  header_title: 'data live24u',
  long_desc: 'This is a infinityknow.com data.'
}, {
  header_title: '404Error',
  long_desc: '404 Page not found.'
}];
new Vue({
  el: '#liveapp',
  data: {
   data_msg: []
  },
  ready: function() {
   this.get_fetchmsg();
  },
  methods: {
   get_fetchmsg: function() {
     var self = this;
     // simulate the ajax request
     setTimeout(function(){
       self.data_msg = data;
     }, 1000);
   }
  }
});

index.js

<a href="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.20/vue.min.js">https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.20/vue.min.js</a>
<div id="liveapp">
<table>
  <tr>
    <th>Index</th>
    <th>Header Title</th>
    <th>Long Description</th>
    <th>Action</th>
  </tr>
  <tr>
    <td>{{$index+1}}</td>
    <td>{{content.header_title}}</td>
    <td>{{content.long_desc}}</td>
    <td><button>Please Click me</button></td>
  </tr>
</table>

Example

READ :  Angularjs Custom Animation nganimate Examples

I hope you have Got What is how to fetch data from database using Vuejs in mvc And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

Add a Comment

Your email address will not be published. Required fields are marked *