问题遇到的现象和发生背景
这边打算学习一下人脸识别技术,调用了百度云的人脸识别接口,但是在html中获取token的get请求和人脸的post接口是报跨域的
问题相关代码
var baiduAccessTokenApi ='https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=' +your_client_id + '&client_secret=' + your_client_secret;
$.ajax({
url: baiduAccessTokenApi,
method: 'GET',
dataType: 'json',
success(res) {
console.log(res)
}
})
运行结果及报错内容
报跨域
我想要达到的结果
前端这边没有好的方法能够处理吗