Site Notice
hello, world
Youdao translate
From Project-EPB Commons
<html> <label for="origin">原文</label> <textarea id="origin" style="max-width: 100%; min-width: 100%; min-height: 4em"></textarea> <label>翻译</label> <pre id="translation"></pre> <button onclick="translate">开始翻译</button>
<script>function translate() { var text = $('#origin').val(); if (text === '') return; $.ajax({
url: 'https://fanyi.youdao.com/openapi.do', data: { keyfrom: 'youdaoci', key: '694691143', type: 'data', doctype: 'jsonp', version: '1.1', q: text }, dataType: 'jsonp'
}).done((data)=>{
var translation = data.translation[0]; $('#translation').text(translation);
}) } </script> </html>