title: Uncaught ReferenceError: result is not defined...for displayCars(result);
body: <p>I have the following snippet of code.  Am getting an Uncaught ReferenceError: result is not defined...for displayCars(result);</p>
  
  <p>The code is:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  $(document).ready(function() {
  
  displayCars(result);
  
  function displayCars () {
  
      $.ajax({
          type : 'GET',
          url : '/modules/crm/selector-ajax.php',
          data : {
              'action' : 'get-images'
          },
          success : function(result) {
  
              var photoDiv = $('#boat_isotope_gallery');
              var divHtml = '';
              var resultArray = $.parseJSON(result);
  
              photoDiv.html(divHtml);
  
          },
          error : function(err) {
              console.log('ajax failure');
          }
      });
  }
  }); // end of document ready
  &lt;/script&gt;
  </code></pre>
  
  <p>I've seen the postings about the order of calling scripts.  My scripts are called in a header document.  They are called in the following order and prior to the snippet above:</p>
  
  <pre><code>&lt;script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="//code.jquery.com/ui/1.10.2/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/scripts/tools.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/scripts/jquerymenus.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/scripts/chosen.jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/scripts/jquery.cookie.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="https://netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"&gt;   &lt;/script&gt;
  &lt;script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.3/js/jasny-bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"&gt;&lt;/script&gt; 
  &lt;script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.0.0/isotope.pkgd.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.5.2/d3.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/scripts/selector.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Why am I getting this error?</p>