Whenever I look at my code, the parameter dbtask
is consistently showing up as null
.
If we navigate to , we can see the data displayed below:
[{"idknowledgedescription": null, "idexercise": null, "answerpath": "浙江数学文testpdf.pdf", "value": null, "iddailytask": 1, "briefanswer": "A", "time": null, "idstudents": 1, "exercisepath": "浙江数学文testpdf.pdf", "timeofplan": "2018-03-15", "timeoflearn": "2018-03-15T00:00:00", "anserofstudent": null, "tipspath": "浙江数学文testpdf.pdf"}]
<!DOCTYPE html>
{% load static %}
<html>
<head>
<meta charset="utf-8"/>
<script src="{% static 'jslib/vue.js'%}"></script>
<script src="{% static 'jslib/reqwest.js'%}"></script>
<script typet="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="{% static 'css/semantic.min.css'%}" media="screen" title="no title" charset="utf-8">
</head>
<body>
{% verbatim %}
<div id="app-6">
<li v-for="t in dbtask">
{{t.exercisepath}}
</li>
</div>
{% endverbatim %}
</div>
</body>
</html>
<script type="text/javascript">
var app6 = new Vue({
el: '#app-6',
data: {
dbtask:null,
},
created() {
setTimeout(() => {
this.bbb()
}, 1000);
},
methods: {
bbb: function() {
var self=this;
<!--var a={};-->
$.getJSON('http://127.0.0.1:8000/tasks/',function(task){
self.dbtask = task;
alert(self.dbtask[0].exercisepath);
});
}.bind(this)
}
})
</script>
`