Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

BAIDOの翻訳APIでのCORBエラー

問題点

BAIDOの翻訳APIをコールしていますが、CORBエラーが出ます

対処

JSONPでGET送信なので、問題ないように思います。

DJANGOサーバーをローカルホストで動かしています。

何か落ち度はありましたでしょうか?


function translateB(query,LangFrom,LangTo,elem){

var appid = '2015063000000001';
var key = '12345678';
var salt = (new Date).getTime();

var str1 = appid + query + salt +key;
var sign = MD5(str1);
$.ajax({
    url: 'https://fanyi.baidu.com/v2transapi',
    type: 'get',
    dataType: 'jsonp',
    data: {
        q: query,
        appid: appid,
        salt: salt,
        from: LangFrom,
        to: LangTo,
        sign: sign
    },
    success: function (data) {
        console.log(data);
        $(elem).val(data);
    } 
});
}


jquery-3.2.1.min.js:4 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://fanyi.baidu.com/v2transapi?callback=jQuery3210036284152826021376_1616549475849&q=&appid=2015063000000001&salt=1616549487470&from=zh&to=Yue&sign=037e893451f6320448ed08100d6c325d&_=1616549475850 with MIME type application/json. 
0

1Answer

Your answer might help someone💌