Updated mithril to do as it has to do

This commit is contained in:
2017-09-28 11:43:28 +07:00
parent 7c61498047
commit b704e2f1a7
2 changed files with 32 additions and 29 deletions

View File

@@ -7,13 +7,14 @@
</main>
<script>
var root = document.getElementById('mit')
var text = ''
var count = 0
var timer = 10000; // 10 seconds
var rend = {
view: function() {
return m('section', [
m('h1', 'Mithril'),
m('p', text),
m('p', 'You got ' + count + ' data(s)'),
m('button', {
class: 'pseudo',
onclick: getdata
@@ -30,14 +31,13 @@
withCredentials: true
})
.then(function(get) {
getdata.list = get.data
getdata.list = get
count = getdata.list.count
})
for (var i = 0; i < getdata.list.length; i++) {
text = text + getdata.list[i].judul + ' '
}
}
m.mount(root, rend)
setInterval(getdata, timer);
</script>
{% endblock %}