title: Retrieving JSON data using Ajax in Javascript
body: <p>I don't think this is a repeat because I can't find a specific answer anywhere.  I'm new to JavaScript and can't figure out how to pull JSON information in using Ajax and display it on my page.  I know I'm doing something wrong from simply not understanding the languages that well.</p>
  
  <p>My JSON looks like this:</p>
  
  <pre><code>{ "lots" : [
  {
      "name" : "NE Corner HW4 &amp; 41st",
      "info" : "$2/Hr&lt;br&gt;Monthly Parking Available",
      "center" : {
          "lat" : 57.659390,
          "lng" : -127.414754
      },
      "topLeft" : {
          "lat" : 57.659616,
          "lng" : -127.415102
      },
      "bottomRight" : {
          "lat" :57.659208,
          "lng" :-127.414371
      }
  }, ...etc
  ]}
  </code></pre>
  
  <p>And here's the Ajax call (this may well be wrong):</p>
  
  <pre><code>var jsonFile = $.ajax({
    method: "GET",
    url: "filepath/filename.json",
    dataType: "JSON"
  });
  </code></pre>
  
  <p>Then I need to use the info in several functions:</p>
  
  <pre><code>for (var i = 0; i &lt; jsonFile.lots.length; i++) {
    marker = new google.maps.Marker({
    position: new google.maps.LatLng(jsonFile.lots[i].center.lat, jsonFile.lots[i].center.lng)
    marker.setMap(map);
  }
  </code></pre>
  
  <p>What am I doing wrong (besides everything)?  Is it my JSON array?  Do I need to parse or stringify it? Maybe it's the Ajax call.  The Javascript?  I feel like it's probably everything.  Thanks for any help!</p>