Microsoft Translator APIを使って、milkcocoa内のテキストを翻訳したいと思っています。
いろいろ調べてみると、node.jsなどサーバー側の処理が必要みたいな気がしていて、jQuery+ajaxでやろうとすると、CORSによってクロスブラウザ問題が発生してしまいます。
$(function() { //1.ミルクココアインスタンスを作成 var milkcocoa = new MilkCocoa("id名"); $("#translate").on("click",function(){ $.ajax({ type: "GET", url: "http://api.microsofttranslator.com/V2/Ajax.svc/Translate", dataType: "jsonp", data: { client_id: 'dktky18', client_secret:'axe19HoGCPTtdu1R3ycOoiVU7ajQDZXLeR8W1iV2jbQ=', scope: 'http://api.microsofttranslator.com', grant_type: 'client_credentials', text: "Hello, world!", from: "en", to: "ja" }, jsonp: "oncomplete", //success: function (data, dataType) { // 結果を表示 success: function(response){ alert(response.status); }, error: function(response){ alert(response.responseText); } //} });
httpの場合だとサーバーを介す必要があると思っているので、実装できないのですが、どういう実装で行えば良いのでしょうか?
よろしくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/10/08 14:46
2015/11/05 11:23