title: How can i get some API info and set as variable
body: <p>When i type a city name in my form i want the name to be send to google Geocode API and obtain latitude and longitude. With the latitude and longitude obtained i want it to send as variable to DarkSky API and get weather informations about that location. The problem it's i can't get the location from form to comunicate with Geocode and Geocode to comumnicate with Darksky.</p>
  
  <p>HTML: </p>
  
  <pre><code>&lt;form class="form" method="post" id="searchF"&gt;
  &lt;div class="search-create"&gt;
      &lt;label class="label-search" for="location"&gt;Enter a location&lt;/label&gt;
      &lt;input type="text" class="form" id="location" placeholder="Location" name="location"&gt;
      &lt;button  class="search-button" type="submit"&gt;Search&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>
      </p>
  
  <pre><code>&lt;?php
  if(isset($_POST['location']))
  {
      $location = $_POST['location'];
      require 'basic.php';
      require 'allday.php';
  
  }
  ?&gt;
  </code></pre>
  
  <p>AJAX:</p>
  
  <pre><code>var forecastData = {
   highTemp: [],
   lowTemp: []
  }
  
  var coordinates = {
  lat : [],
  lng : []
  }
  
  $('#location').keyup(function(){
   var location = $('#location').val();
   $.POST('search.php',{location:location},function(data){
     $('location1').html(data);
     console.log(location);
   });
  });
  
  
  $.ajax({
  type:"GET",
  url:"https://maps.googleapis.com/maps/api/geocode/json?address="+ location + "&amp;key=AIzaSyBBgAUwWtw5w1JMCLU59PZBqqxWZQQA-XE",
  responseType:'jsonp',
  success:function(data){
    coordinates.lat = data.results[0].geometry.location.lat;
    coordinates.long =data.results[0].geometry.location.lng;
    console.log(coordinates.lat);
    console.log(coordinates.long);
  }
  });
  
  
  $.ajax({
  type: "GET",
  url:"https://api.darksky.net/forecast/c0b53b3f4736c755ca1a97eaa3f7efd4/" + coordinates.lat + "," + coordinates.long,
  responseType:'jsonp',
  success: function(data) {
    // console.log(data);
  
    for (i = 0; i &lt; data.daily.data.length; i++) {
      forecastData.highTemp[i] =((data.daily.data[i].apparentTemperatureMax-32)*.5556);
      forecastData.lowTemp[i] = ((data.daily.data[i].apparentTemperatureMin-32)*.5556);
    }
  </code></pre>