Note that there are some explanatory texts on larger screens.

plurals
  1. POOnly some of the data from my meetup JSON file is populating into my Google Maps markers
    primarykey
    data
    text
    <p>I think the problem might have to do with my understanding of $.each. Basically, I'm getting JSON back from the Meetup API and looking in particular at the latitudes and longitutdes of each of the meetup groups the JSON file spits back out, which I'm populating onto a Google Map.</p> <p>The problem is, only some of the groups are appearing with markers! I'm not sure why. The "for" loop seems to be extraneous... </p> <p>Also, I kept in htmlString because all the meetup groups in the JSON file appear correctly in the #groups div. It's just the Google Maps makers that aren't appearing correctly.</p> <p>Can anyone help me understand what exactly I'm doing when I put in marker = new google.maps.Marker inside $.each?</p> <pre><code> var promise = $.getJSON("http://api.meetup.com/groups.json/?zip=12345&amp;radius=8&amp;topic=technology&amp;order=members&amp;key=" + apikey + "&amp;callback=?"); var messagePromise = promise.then(function (data) { var htmlString = ""; $.each(data.results, function (i, item) { htmlString += '&lt;h3&gt;&lt;a href="' + item.link + '" target="_blank"&gt;' + item.name + '&lt;/a&gt;&lt;/h3&gt;' + '&lt;p&gt;&lt;img src="' + item.photo_url + '" width="200"&gt;&lt;/p&gt;' + '&lt;p&gt; &lt;strong&gt;Last active:&lt;/strong&gt; ' + item.updated + ' (' + item.members + ' members) ' + '&lt;/p&gt;' + '&lt;p&gt;' + item.description + '&lt;/p&gt;'; var marker, i, markerColor; for (i = 0; i &lt; 10; i++) { //creating new markers marker = new google.maps.Marker({ position: new google.maps.LatLng(item.lat,item.lon), map: map, icon: blue }); } //end for loop }); //each $('#groups').html(htmlString); }); //first promise </code></pre> <p>Google Maps documentation for how to create new markers: <a href="https://developers.google.com/maps/documentation/javascript/markers#add" rel="nofollow">https://developers.google.com/maps/documentation/javascript/markers#add</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload