赞
踩
- //在线翻译查询(百度翻译)
- $('#selectBtn').click(function() {
- var appid = '你申请的appid';
- var key = '你申请的key';
- var salt = (new Date).getTime();//取当前时间作为随机数
- var query= $('#transInput').val();//取输入框的val
- var q = encodeURIComponent(query);//编码UTF-8
- var from = $('#languageLeft').attr('data-language');//原文
- var to = $('#languageRight').attr('data-language');//译文
- var str1 = appid + query + salt +key;//秘钥
- var sign = MD5(str1);//md5加密
- $.ajax({
- url: 'http://api.fanyi.baidu.com/api/trans/vip/translate',
- type: 'get',
- dataType: 'jsonp',
- data: {
- q: query,
- appid: appid,
- salt: salt,
- from: 'auto',
- to: 'auto
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。