title: How to use Ajax and JSON to get weather info and put it into an HTML paragraph?
body: <p>So I am having a problem learning how to use AJAX and JSON to retrieve weather information from <a href="http://openweathermap.org/" rel="nofollow noreferrer">openweathermap</a> and placing the information into a paragraph in an HTML page.</p>
  
  <p>I found this piece of code <a href="https://stackoverflow.com/questions/27336622/how-i-can-using-json-jquery-in-api-openweathermap-to-get-wheater-information">here</a> which briefly outlines what I need to do, but I don't want JavaScript alerts, and I can't seem to get it working.</p>
  
  <p>My webpage currently looks like this:
  <img src="https://i.stack.imgur.com/jt6tx.png" alt="enter image description here"></p>
  
  <p>And the code for that is here:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;script&gt;
  
  function getWeather()
  {
   $(document).ready(function(){
      $.getJSON("http://api.openweathermap.org/data/2.5/weather?zip=02878,us",function(result){
          var message = ("Weather: "+ result.weather[0].main);
          });
      });
  }
  
  
  document.write(getWeather().message);
  &lt;/script&gt;
  
  
  &lt;head&gt;
  &lt;style&gt;
  firstDay {
      position: absolute;
      left: 10px;
      top:  100px;
      border-radius: 25px;
      background: #8AC007;
      padding: 20px; 
      width: 300px;
      height: 550px; 
  }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;firstDay&gt; &lt;center&gt; &lt;u&gt; &lt;h1&gt; Today &lt;/center&gt; &lt;/u&gt; &lt;/h1&gt;
  &lt;p&gt; Weather here &lt;/p&gt;
  
  &lt;/firstDay&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>It would be awesome if you guys could show me how to get the result from the getWeather() function into the green box under the Today line.</strong></p>