# Issues with local weather challenge

**URL:** <https://forum.freecodecamp.org/t/issues-with-local-weather-challenge/130489>\
**Category:** General\
**Created:** [June 22, 2017, 2:19pm UTC](https://forum.freecodecamp.org/t/issues-with-local-weather-challenge/130489 "2017-06-22T14:19:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garddesigns](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/garddesigns/32/96554_2.png) [@Garddesigns](https://forum.freecodecamp.org/u/Garddesigns)\
**Post date:** [June 22, 2017, 2:19pm UTC](https://forum.freecodecamp.org/t/issues-with-local-weather-challenge/130489/1 "2017-06-22T14:19:00Z")

</div>

I cant seem to output anything from my jquery function, for example in my console log i tried to output the url variable but I can’t and I don’t know why. Can anybody help me? Thank you.  
Here’s my code.  
HTML:

# Local Weather

CSS:  
body{  
background-color:#555;  
text-align:center;  
font-family:Dosis;  
color:#fff;  
}

JS:  
$(document).ready(function(){  
var long;  
var lat;  
if (navigator.geolocation) {  
navigator.geolocation.getCurrentPosition(function(position) {

```
long = position.coords.longitude;
lat = position.coords.latitude;

var url='http://api.openweathermap.org/data/2.5/weather?lat='+lat+'&lon='+long+'&appid=3f03e3e0569f04ffcc024fcf0b4958c6';

```

$.getJSON(url, function(data){  
var weatherType=data.weather[0].description;  
var kelvin=data.main.temp;  
var windSpeed=data.wind.speed;  
var city=data.name;  
$("#data").html(city);  
});  
$("#data").html(‘url’);  
});  
}

});

---

<div class="post-metadata">

**Author:** ![Gwesolo](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/gwesolo/32/4684_2.png) [@Gwesolo](https://forum.freecodecamp.org/u/Gwesolo)\
**Post date:** [June 22, 2017, 2:37pm UTC](https://forum.freecodecamp.org/t/issues-with-local-weather-challenge/130489/2 "2017-06-22T14:37:42Z")

</div>

Most likely a cross-origin issue. Happens when using a http api on a https page, if you check your browser console, you should see it flagged up in red.

Quick fix would be to add `https://cors-anywhere.herokuapp.com/` onto the start of your api url.

---

<div class="post-metadata">

**Author:** ![Garddesigns](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/garddesigns/32/96554_2.png) [@Garddesigns](https://forum.freecodecamp.org/u/Garddesigns)\
**Post date:** [June 22, 2017, 2:40pm UTC](https://forum.freecodecamp.org/t/issues-with-local-weather-challenge/130489/3 "2017-06-22T14:40:47Z")

</div>

OK thanks that worked

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:55pm UTC](https://forum.freecodecamp.org/t/issues-with-local-weather-challenge/130489/4 "2021-01-17T20:55:27Z")

</div>

Closed on January 17, 2021, 8:55pm UTC


