I'd like to be able to have a js function that contains an ajax call to return a value that the ajax success handler returns.
Here's my jsfiddle of where I'm at right now. I'm using a dummy json endpoint for illustration. I want someFunction to return the same thing I'm currently logging in the console.
http://jsfiddle.net/ivansifrim/qgfo6zqe/
$(document).ready(function(){
  function someFunction(){
    $.ajax({ 
      url: 'http://api.openweathermap.org/data/2.5/weather?id=2172797',
      type: 'GET',
      success: function(result) {
        console.log(result.coord);
        $("#result").html(result.coord.lat);
      },
      error: function(result) {
        console.log("something went wrong");  
      }
    });
  };
  $("#click-test").click(function(){
    someFunction();
  });
});
I would really appreciate some help and am more than happy to provide any more context if needed. Thank you!
