var data_fromServer;
$http({
method: 'GET',
url: 'http://127.0.0.1:8080/stat'
}).then(function successCallback(response) {
console.log(response.data)
data_fromServer = response.data
}, function errorCallback(response) {
console.log("Can't get the data!")
});
console.log(data_fromServer);
$http({
method: 'GET',
url: 'http://127.0.0.1:8080/stat'
}).then(function (response) {
return response.data;
}).then(function (data) {
console.log(data);
}).catch(function () {
console.log("error");
});