-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwds.html
More file actions
52 lines (49 loc) · 1.99 KB
/
wds.html
File metadata and controls
52 lines (49 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<html>
<head>
<title>WDS</title>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'></script>
<script>
function test() {
var domain_code = 'GE';
var sql = {
query: 'SELECT E.ElementListNameE, E.UnitNameE ' +
'FROM Element E, DomainElement D ' +
'WHERE D.DomainCode = \'' + domain_code + '\' ' +
'AND D.ElementCode = E.ElementCode ' +
'GROUP BY E.ElementListNameE, E.UnitNameE, D.OrderE ' +
'ORDER BY D.OrderE'
};
var data = {};
data.datasource = 'faostat';
data.thousandSeparator = ',';
data.decimalSeparator = '.';
data.decimalNumbers = 2;
data.json = JSON.stringify(sql);
data.cssFilename = '';
data.nowrap = false;
data.valuesIndex = 0;
$.ajax({
type : 'POST',
url : 'http://faostat3.fao.org/wds/rest/table/json',
data : data,
success: function (response) {
var json = response;
if (typeof json == 'string')
json = $.parseJSON(response);
console.debug(json);
var s = 'Measurement Unit for ' + domain_code + ': ' + json[0][0] + ' (' + json[0][1] + ')';
document.getElementById('container').innerHTML = s;
},
error: function (e, b, c) {
console.debug(e);
console.debug(b);
console.debug(c);
}
});
}
</script>
</head>
<body onload='test();'>
<div id='container'></div>
</body>
</html>