# Weather challenge: Jquery not working with HTML

**URL:** <https://forum.freecodecamp.org/t/weather-challenge-jquery-not-working-with-html/153655>\
**Category:** General\
**Created:** [October 17, 2017, 6:23pm UTC](https://forum.freecodecamp.org/t/weather-challenge-jquery-not-working-with-html/153655 "2017-10-17T18:23:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunshadow](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@sunshadow](https://forum.freecodecamp.org/u/sunshadow)\
**Post date:** [October 17, 2017, 6:23pm UTC](https://forum.freecodecamp.org/t/weather-challenge-jquery-not-working-with-html/153655/1 "2017-10-17T18:23:54Z")

</div>

I’m working on show local weather challenge and was progressing fine (with some issues here and there) but I managed to get my API to work and use jquery to interact with the html. So then I began to work on the html a bit to get the website layout finished and comment out areas for button and images.

Ever since I have been trying to run the code again but the values from API aren’t showing anymore (like temperature and city).

If someone can please take a quick look and see what is causing the problem and why they are not showing anymore. I’ve edited out my API key (but it works), I’m still working on the code if it looks messy that’s why. Thanks a lot! any help is appreciated  
Below is my HTML code:

```auto
<div class = "container fluid">
<h1>You are currently in the city of:<h1> 
  <br>
<p id="city"></p>
<br>
<h1>Where the weather is:</h1>
<p id="weather"></p>
  <br>
<p id="temp"></p>
   
  <br>
 
  <div>
  <button class="btn btn-success" type="submit">Convert temperature to Celsius</button>
  </div>
</div>
  

```

and this is my JS:

```auto
$(document).ready(function(){
var lat;
var long;
var temp;
var celsius = Math.round(data.main.temp - 273);  
  if (navigator.geolocation){
    navigator.geolocation.getCurrentPosition(function(position){
      
      lat = position.coords.latitude;
      long = position.coords.longitude;
      
      $("#location").html("latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude);

 //Create API with geolocation 
var weatherURL = "https://api.openweathermap.org/data/2.5/weather?lat="+lat+"&lon="+long+"&appid=000"
    
      $.getJSON(weatherURL, function(data){
       $("#city").html(data.name); 
       $("#temp").html("Temperature: " + data.main.temp);
       $("#weather").html(data.weather[0].description);    
     
            });      
});
  }
  });

      
// celsius button 
// $.function button cel to f
// $.function button f to cel

//images switch stateements
    // if ("#weather".match = "sun") {
    // $.getJSON("#image").show(<img src = " ">)

```

---

<div class="post-metadata">

**Author:** ![sunshadow](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@sunshadow](https://forum.freecodecamp.org/u/sunshadow)\
**Post date:** [October 17, 2017, 6:37pm UTC](https://forum.freecodecamp.org/t/weather-challenge-jquery-not-working-with-html/153655/2 "2017-10-17T18:37:23Z")

</div>

I GOT IT TO WORK 😃  
thank you anyway

---

<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:37pm UTC](https://forum.freecodecamp.org/t/weather-challenge-jquery-not-working-with-html/153655/3 "2021-01-17T20:37:14Z")

</div>

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


