I'm trying to append the results from an ajax call to a paragraph using jQuery.
I would like to return the variable "myResult" from the inner getResult function and pass it to the outer buildParagraph function, but the value returned is undefined. 
How do I append the value of myResults to the <p> tag as indicated below? 
function buildParagraph () {
   function getResult(url) {  
      $.getJSON(url, function(data) {
         var myResult = data.results;
         return myResult;
      } 
   }
  var myUrl = 'www.mywebsite.com';
  getResult(myUrl);
  $('<p>').html(myResult);
}
 
    