Есть POST запрос на yandex.translate (
https://tech.yandex.ru/translate/doc...slate-docpage/)
Но почему-то он не возвращает ответ.
http://jsbin.com/jolijep/edit?html,js,console,output
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Angular JS</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="weather.js"></script>
</head>
<body ng-app="jsbin">
<div ng-controller="DemoCtrl as vm">
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/weatherscript.js"></script>
<script src="weather.js"></script>
{{PostDataResponse}}
{{vm.data}}
</div>
</body>
</html>
Скрипт:
var app = angular.module('jsbin', []);
app.controller('DemoCtrl',function($scope, $http){
var url = "https://translate.yandex.net/api/v1.5/tr.json/translate",
keyAPI = "trnsl.1.1.20130922T110455Z.4a9208e68c61a760.f819c1db302ba637c2bea1befa4db9f784e9fbb8";
var vm = this;
$scope.SendData = function () {
// тут данные
var textApi='Hello';
var langApi='en-ru';
var data = "key="+keyAPI+"&text="+textAPI+"&lang="+langAPI;
$http.post(url, data)
.success(function (data, status, headers, config) {
vm.data = response.data;
$scope.PostDataResponse = data;
console.log(data);
})
.error(function (data, status, header, config) {
$scope.ResponseDetails = "Data: " + data +
"<hr />status: " + status +
"<hr />headers: " + header +
"<hr />config: " + config;
});
};
});