현재 MS Bing Translator 버전을 새로운 Azure 버전으로 변환하려고합니다. 새로운 문서 및 Microsoft에서 제공하는 (푸른 용) 다음 예제 있지만 설명 Microsoft Azure Translator AJAX API가 작동하지 않습니다.
내가 제대로 작동하는 액세스 토큰을 생성 :function translate() {
var from = "en", to = "es", text = "hello world";
var s = document.createElement("script");
s.src = "http://api.microsofttranslator.com/V2/Ajax.svc/Translate" +
"?appId=" + settings.appID +
"&from=" + encodeURIComponent(from) +
"&to=" + encodeURIComponent(to) +
"&text=" + encodeURIComponent(text) +
"&oncomplete=mycallback";
document.body.appendChild(s);
}
function mycallback(response) {
alert(response);
}
내가 jQuery를 호출에 위의 코드를 변환하고 싶습니다.
나는 일 이전 버전에서 유사한 jQuery를 아약스 호출을 수정하지만,parseerror-jQuery17206897480448242277_1343343577741 was not called
가 발행됩니다 :
function jqueryTranslate() {
var p = {};
p.appid = settings.appID;
p.to = "es";
p.from = "en";
p.text = "Goodbye Cruel World";
p.contentType = 'text/html';
$.ajax({
url: 'http://api.microsofttranslator.com/V2/Ajax.svc/Translate',
data: p,
dataType: 'jsonp',
jsonp: 'oncomplete',
complete: function (request, status) {
},
success: function (result, status) {
alert(result);
},
error: function (a, b, c) {
alert(b + '-' + c);
}
});
}
내가 아주 많이 감사하고 TIA 그래서 당신의 시간 동안, 무슨 일이 잘못 이해합니다.
C#에서 새 액세스 토큰 메커니즘을 구현했습니다. 당신이 제공 한 두 번째 링크는 추구 할 보람있는 전략처럼 보입니다. 감사! –