Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

vuejs get data fromo ajax

<script type="text/javascript">
var ItemsVue = new Vue({
    el: '#Itemlist',
    data: {
        items: []
    },
    mounted: function () {
        var self = this;
        $.ajax({
            url: '/items',
            method: 'GET',
            success: function (data) {
                self.items = JSON.parse(data);
            },
            error: function (error) {
                console.log(error);
            }
        });
    }
});
</script>

<div id="Itemlist">
    <table class="table">
        <tr>
            <th>Item</th>
            <th>Year</th>
        </tr>
        <tr v-for="item in items">
            <td>{{item.DisplayName}}</td>
            <td>{{item.Year}}</td>
        </tr>
    </table>
</div>
Comment

PREVIOUS NEXT
Code Example
Javascript :: simple search filter for table html 
Javascript :: how to update mongodb collection with a new field 
Javascript :: delete in array 
Javascript :: promise javascript 
Javascript :: convert json string to byte array java 
Javascript :: node js login and registration 
Javascript :: jquery onchange get element 
Javascript :: how to set onmouseover in javascript 
Javascript :: jquery save method 
Javascript :: change app name in react native android 
Javascript :: javascript array find case insensitive 
Javascript :: what are built in objects in javascript 
Javascript :: nesting express routes 
Javascript :: how to decode jwt token in angular 
Javascript :: write files in Node.js 
Javascript :: custom eslint config react hooks 
Javascript :: iterate object in js 
Javascript :: string.regex match 
Javascript :: react native mock 
Javascript :: .catch chain 
Javascript :: react native cli sdk.dir 
Javascript :: drupal 8 webform insert node twig value 
Javascript :: css javascript 
Javascript :: documentelement javascript 
Javascript :: js on highlight 
Javascript :: what are escape characters in javascript 
Javascript :: javascript try...catch...finally 
Javascript :: create javascript set 
Javascript :: strong password javascript 
Javascript :: FTP download local file 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =