title: Call two JavaScript functions from one button
body: <p>I'm trying to execute two separate functions from one onClick.</p>
  
  <p>It is a dictionary service which returns definitions from Glosbi API and the second function is Google Maps API call that changes the map to what has been searched for.</p>
  
  <p>The first functions works perfectly, but the second function calling Google Maps API doesn't work.</p>
  
  <p>Can anyone see anything in my code that isn't right or needs to be changed? I feel very close!</p>
  
  <pre><code>function codeTerm() {
      $(document).ready(function(){
  
          $('#term').focus(function(){
              var full = $("#definition").has("definition").length ? true : false;
              if(full === false){
                  $('#definition').empty();
              }
          });
  
          var getDefinition = function(){
              var word = $('#term').val();
  
              if(word === ''){
                  $('#definition').html("&lt;h2 class='loading'&gt;We haven't forgotten to validate the form! Please enter a word.&lt;/h2&gt;");
              }
              else {
                  $('#definition').html("&lt;h2 class='loading'&gt;Your definition is on its way!&lt;/h2&gt;");
                  $.getJSON("http://glosbe.com/gapi/translate?from=eng&amp;dest=eng&amp;format=json&amp;phrase=" +word+ "&amp;pretty=true&amp;callback=?", function(json) {
                      if (json !== "No definition has been found."){
                          var meanings = "";
                          json["tuc"].forEach(function(tuc) {
                              if (typeof tuc["meanings"] !== 'undefined') {
                                  tuc["meanings"].forEach(function(m) {
                                      meanings += "&lt;p&gt;"+m["text"]+"&lt;/p&gt;\n";
                                  }); 
                              }
                          });
  
                          $("#definition").html(meanings);
                      } 
                      else {
                          $.getJSON("http://glosbe.com/gapi/translate?from=eng&amp;dest=eng&amp;format=json&amp;phrase=&amp;pretty=true" + "?callback=?", function(json) {
                              console.log(json);
                              $('#definition').html('&lt;h2 class="loading"&gt;Nothing found.&lt;/h2&gt;&lt;img id="thedefinition" src=' + json.definition[0].image.url + ' /&gt;');
                          });
                      }
                  });
              }
              return false;
          };
  
          $('#search').click(getDefinition);
          $('#term').keyup(function(event){
              if(event.keyCode === 13){
                  getDefinition();
              }
          });
      });
  }
  
  var geocoder;
  var map;
  
  function initialize() {
      geocoder = new google.maps.Geocoder();
      var latlng = new google.maps.LatLng(-34.397, 150.644);
      var mapOptions = {
          zoom: 8,
          center: latlng
      }
  
      map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
  }
  
  function codeAddress() {
      var country = document.getElementById('search').value;
      geocoder.geocode( { 'search': country}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
              map.setCenter(results[0].geometry.location);
              var marker = new google.maps.Marker({
                  map: map,
                  position: results[0].geometry.location
              });
          } else {
              alert('Geocode was not successful for the following reason: ' + status);
          }
      });
  }
  
  google.maps.event.addDomListener(window, 'load', initialize);
  
  $('#search').click(country);
  $('#term').keyup(function(results){
      if(results.keyCode === 13){
         country();
      }
  });
  </code></pre>
  
  <p>And the HTML</p>
  
  <p>
  </p>
  
  <pre><code>&lt;head&gt;
  
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
      &lt;meta name="author" content="Matthew Hughes"&gt;
      &lt;meta name="Dictionary" content="A dictionary web service"&gt;
      &lt;title&gt;Dictionary Web Application&lt;/title&gt;
      &lt;script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js"&gt;&lt;/script&gt;
      &lt;script src="dictionary.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" href="style.css" /&gt; 
      &lt;script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCVD1Kaf1yE4M9IcBNRAyujObcY2sGI0J0&amp;sensor=false"&gt;&lt;/script&gt;
      &lt;script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false"&gt;&lt;/script&gt;
      &lt;script src="dictionary.js"&gt;&lt;/script&gt;
  
  
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;div id="container"&gt;
  
          &lt;div id="top"&gt;
  
              &lt;header&gt;
  
                  &lt;h1&gt;Dictionary Application&lt;/h1&gt;
  
              &lt;/header&gt;
  
          &lt;/div&gt;
  
          &lt;div id="app"&gt;
  
              &lt;div id="panel"&gt;
  
                  &lt;input id="term" type="text" placeholder="Enter a word..."&gt;
                  &lt;button id="search" onclick="codeTerm(); codeAddress();"&gt;Define!&lt;/button&gt;
  
  
              &lt;/div&gt;
  
          &lt;section id="definition"&gt;
  
          &lt;/section&gt;
  
                &lt;div id="map-canvas"&gt;
  
                &lt;/div&gt;
  
          &lt;/div&gt;
  
  
  
          &lt;footer&gt;
  
              &lt;p&gt;Created by Matthew Hughes&lt;/p&gt;
  
          &lt;/footer&gt;
  
      &lt;/div&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thanks!</p>