【发布时间】:2016-10-12 04:44:11
【问题描述】:
我有一张桌子
<table>
<thead>
<tr>
<th>Year</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>1990</td>
<td>-</td>
</tr>
...
</tbody>
</table>
我想向 World Bank API 发出 GET 请求以填写此表中的值。
我的 GET 请求在 Meteor 方法中
Meteor.methods({
getData: function () {
try {
const url = 'http://api.worldbank.org/countries/br/indicators/NY.GDP.MKTP.CD?date=1990:2000&format=json';
const request = HTTP.get(url);
return request;
} catch (e) {
console.log(e);
return false;
}
},
});
我从客户端调用我的方法
Meteor.call('getData', function(error, result) {
console.log(result);
});
所以我得到了控制台中的值,但我想用正确的值替换 html 表中的-。
【问题讨论】:
标签: javascript html node.js servlets meteor