title: Method that uses a button to convert requested data to different metric
body: <p>At the moment, I have been able to request temperature from DarkSky's API, but degrees are in Fahrenheit when displayed on the user's screen. Consequently, I was wondering if could wrap my existing JS code with that button so that I could convert from Celsius to Fahrenheit and vise-versa? Perhaps I need to wrap the my temperature id in a button and use a function of some sort? </p>
  
  <p>Here's my codepen: <a href="https://codepen.io/baquino1994/pen/ayJOod?editors=1011" rel="nofollow noreferrer">https://codepen.io/baquino1994/pen/ayJOod?editors=1011</a></p>
  
  <p>HTML</p>
  
  <pre><code>&lt;head&gt;
  
    &lt;meta name = "viewport" content ="width=device-width, intitial-scale = 1"/&gt;
    &lt;link rel = "stylesheet" href ="style.css"/&gt;
    &lt;link rel = "http://ipinfo.io"/&gt;
    &lt;title&gt;Weather&lt;/title&gt;
    &lt;link href="https://fonts.googleapis.com/css?family=Monoton" rel="stylesheet"&gt;
    &lt;script src = https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  
  
  &lt;body&gt;
   &lt;header&gt;
     &lt;h1&gt;&lt;div id="minutely"&gt;&lt;/div&gt;&lt;/h1&gt;
   &lt;h2&gt;&lt;div id="location"&gt;&lt;/div&gt;&lt;/h2&gt;
   &lt;/header&gt;
    &lt;p&gt;&lt;span id="city"&lt;/span&gt;&lt;/p&gt;
  
  
    &lt;p&gt; &lt;span id="country"&gt;&lt;/span&gt;&lt;/p&gt;
    &lt;div id="temp" id="tempunit"&gt;&lt;/div&gt;
    &lt;button class="btn btn-primary" id="BT1"&gt;Change Metric&lt;/button&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>function weather(){
      function success(position){
          var latitude = position.coords.latitude;
      var longitude= position.coords.longitude;
          // location.innerHTML = "Latitude:" + latitude+"°"+ "Longitude: " + longitude+'°';
          var theUrl = url +apiKey + "/"+ latitude+","+ longitude +"?callback=?";
  
      $.getJSON(theUrl, function(data){
          $("#temp").html(data.currently.temperature)
        $("#minutely").html(data.minutely.summary)
  
  
    $.ajax({
        url:'', dataType: 'json',
       success: function(results){
           $("#city").text(results.results[3].address_components[4].long_name)
    $("#country").text(results.results[0].address_components[5].long_name)
  
       }
  
  
   }
  
  
  
  
      )}
               );
     }    
  
  
  var location = document.getElementById("location");
  var apiKey = "";
  var url = "https://api.darksky.net/forecast/";
  navigator.geolocation.getCurrentPosition(success);
  // location.innerHTML = "Locating...";
  
     }
  $(document).ready(function(){ 
  weather();
   });
  </code></pre>