Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当我从其他函数中存在的另一个api(openweathermap)获取LatLng时,没有获取映射_Javascript - Fatal编程技术网

Javascript 当我从其他函数中存在的另一个api(openweathermap)获取LatLng时,没有获取映射

Javascript 当我从其他函数中存在的另一个api(openweathermap)获取LatLng时,没有获取映射,javascript,Javascript,我给出initMap函数参数,在getWeather()函数中调用它,并将参数设置为响应中的数据。请帮帮我 'use strict'; function initMap(latt, lonn) { exports.map = new google.maps.Map(document.getElementById('coord'), { center: { // lat: latt, lng: lonn, },

我给出initMap函数参数,在getWeather()函数中调用它,并将参数设置为响应中的数据。请帮帮我

'use strict'; function initMap(latt, lonn) { exports.map = new google.maps.Map(document.getElementById('coord'), { center: { // lat: latt, lng: lonn, }, zoom: 8, }); } exports.initMap = initMap; })((this.window = this.window || {})); function getWeather(unit) { const baseUrl = 'https://api.openweathermap.org/data/2.5/weather'; const apiKey = 'c1324c84503b87d7b5673182adeeeb23c'; const cityToSearch = $('#cityToSearch').val(); $.ajax(`${baseUrl}?q=${cityToSearch}&appid=${apiKey}&units=${unit}`) .then(function (response) { initMap(`${response.coord.lat}`, `${response.coord.lon}`);``` "严格使用",; 函数初始化映射(latt、lonn){ exports.map=new google.maps.map(document.getElementById('coord'){ 中心:{ // 拉特:拉特, 朗恩, }, 缩放:8, }); } exports.initMap=initMap; })((this.window=this.window |{}); 气象功能(单位){ 常量baseUrl=https://api.openweathermap.org/data/2.5/weather'; 常数apiKey='C1324C84503B87D7B5673182ADEEB23C'; 常量cityToSearch=$('#cityToSearch').val(); $.ajax(`${baseUrl}?q=${cityToSearch}&appid=${apiKey}&units=${unit}`) .然后(功能(响应){ initMap(`${response.coord.lat}`、`${response.coord.lon}`)```