WeatherApp - not returning proper temperature

I’ve looked everywhere for a clue, or someone facing a similar problem as me. But I’ve found nothing; perhaps I don’t know what to properly search for.

Anyway, I apologize in advance if this has been asked already.

So, my code is returning a temperature. But it’s not in a proper format. For example, if it’s 30 degrees out, it’s returning something like “271.32”

Here is the code:

** This weather app made possible with the open-weather API: 
** Images obtained for free at:

  // Click event to rid the annoyance of the location request
  $('#getWeather').click(function() {
    var lat;
    var long;
    // Get user location 
    if (navigator.geolocation){
        // Display current location - might need to get rid of this

  // Returning the weather
   lat = position.coords.latitude;
   long = position.coords.longitude; 

  // When this code is published to codepen, github, etc.
  // use this URL in front of the api's URL:

   // 'reaching out' to the API, and returning 'raw' JSON data
  $.getJSON("" +
                                                              lat +
                                                             long +
                          function(json) {                           
                            $("#town").html("<p><b>Location: </b></p>" +

                            $("#data").html("<p><b>Temperature: </b></p>" +
                            /*$("#data").html("<p class='rise'>Temperature: </p>" +
                           }, function(error){ 

// $('#data').html("current temp: " + data.main.temp);

Hi… perhaps you should have a better look at the api docs. I’m not 100% sure but i guess the default temp is coming in Kelvins.

Read the doc about units formatting in OpenWeatherMap Api Docs.

i think it’s something like units=[value] you need. :slight_smile:

Hi, imerljak. Thank you! I had no idea there was more documentation(didn’t bother scrolling all the way down)! Such a relief. Hopefully I’ll be able to figure this out now.

Thanks again!!!