晓得杂解决跨域 吧 我用的是ajax请求的var tep="网络原因出错";tep=$.ajax({url:"http://openapi.baidu.com/public/2.0/bmt/translate?client_id=2ALMz6WqUEcsBg4BS91Eppq3&q="+str+"&from=auto&to=auto",type:"post", dataType:"html",data: "name="+vg,error: function(){ // alert("Http status: "+xhr.status+" "+xhr,statusText+"\najaxOptions:"+ajaxOptions+"\nthrownError:"+thrownError+"\n"+xhr.responseText );alert("请设置:Internet选项-安全-自定义级别-其它-跨域访问数据源设置为“启用”状态");},success:function(msg){var msg = eval("("+msg+")");//接受翻译后返回来的结果obj.innerHTML=msg.trans_result[0].dst;//翻译后的结果}});
- 1 回答
- 0 关注
- 721 浏览
添加回答
举报
0/150
提交
取消