Wechat transforms latitude and longitude from Baidu map api to city address report after solving the cross-domain problem.

Wechat longitude and latitude using Baidu map api to city address report cross-domain problem solved and reported to the 404 god to help solve

let url =" http://api.map.baidu.com/geoc." / / GET request directly put the browser to execute the request and you can see the returned result.

            let _config = {
                headers: {
                "Content-Type": "application/json"
                }
            }; 
            let _this = this;            
            this.GLOBAL.get(_this, url, _config, function(datas){
                console.log(datas);                        
            }) 
            
            url
            404

clipboard.png
axios.get ("/ geocoder/v2/?ak=btsVVWf0TM1zUBEbzFz6QqWF&callback=renderReverse&location=" + this.latitude +","+ this.longitude +"& output=json&pois=1"). Then (res= > {

)
            console.log(res.data);
            this.list = res.data.list
        }).catch(error=>{
            console.log(error);
        })
Oct.14,2021

landlord, hello ~
there are three solutions:
first of all, axios does not support jsonp , because the authors of axios find jsonp unfriendly, and it is recommended to use CORS , but jsonp supports a wider range, and some old-fashioned IE browsers can also support it, so some companies still use jsonp . This method is recommended

  https://www.chromestatus.com/. for more details. 

Menu