【发布时间】:2018-04-08 22:42:41
【问题描述】:
{ message: "Hello how are you", status: false, state: Kerala }
以下值是 AJAX 请求的响应。每次响应都会发生变化。我需要使用 Vue.js 打印它吗?
<script>
regBox = new Vue({
el: "#regBox",
data: {
username : '',
},
methods: {
handelSubmit: function(e) {
data = {};
data['username'] = this.username;
$.ajax({
url: 'https://herokuapp.com/api/user/box/',
data: data,
type: "POST",
dataType: 'json',
success: function(e) {
if (e.status) {
alert(" Success")
} else {
alert("failed");
}
}
});
return false;
}
},
});
</script>
【问题讨论】:
-
也许这个问题中的评论演示会有所帮助:stackoverflow.com/questions/46927074/…
-
我没有同样的想法
标签: javascript php html vue.js