Never mind, problem solved. I just rearranged the latitude and longitude in the xml file for the items that were out of order.
Thanks again for the help. On Dec 20, 11:52 pm, Neil <[email protected]> wrote: > It looks like I may have spoken a little too soon. Michal's solution > worked well; theinfowindowsare now all being populated without any > repeated text. > > The only issue is that they are slightly out of order. I thought it > may have to do with the arrays starting at index 0 and the length of > the listings starting at 1, but theinfowindowsaren't consistently > out of order. > > The latest version is here if anyone else has any thoughts: > > http://nsatterfield.userworld.com/AJAX_Lab10Project3_Dec20_v4.html > > Thanks again, > > Neil > > On Dec 20, 6:58 pm, Neil <[email protected]> wrote: > > > Thank you very much Marcelo and Mical B. > > > You helped me solve the problem and gave me good information about > > function closures in JavaScript. > > > Thanks again, > > > Neil > > > On Dec 16, 11:49 pm, Michał Biniek <[email protected]> wrote: > > > > Hi, > > > > You have assigndatato clickable markers to global variables: > > > theAddress1, theName1, thePhone1 - and in function handleResponse > > > these variables are still overwriting till last "listing". > > > It's the reason, why on map is still the samedata- global variables > > > contains the last "listing"data. You have to storedatain array, and > > > when you create markers event - pass number of row to the function for > > > example: > > > > var address = new Array(): > > > var name = new Array(); > > > var phone = new Array(); > > > > function handleResponse() { > > > > .... > > > > // MARKERS - this is for the individualinfowindowswhen markers are > > > clicked > > > address.push(addressobj[0].firstChild.data); > > > name.push(firstobj[0].firstChild.data+ " " + lastobj > > > [0].firstChild.data); > > > phone.push(phoneobj[0].firstChild.data); > > > > .... > > > > } > > > > function createMarker(points, i) { > > > var marker = new GMarker(points); > > > GEvent.addListener(marker, "click", function() { > > > // revised 12/12 > > > //alert(points); // Works - alerts individual coordinates when > > > each marker is clicked > > > > > > marker.openInfoWindowHtml(name[i]+"<br/>"+address[i]+"<br/>"+phone[i]); > > > > }); > > > > return marker; > > > > } > > > > Michal B. > > > > On 17 Gru, 07:44, Neil <[email protected]> wrote: > > > > > Hello everyone, > > > > > I just finished a final project for an AJAX course offered by > > > > O'Reilly, but one aspect of my project has my teacher and me stumped, > > > > so she suggested posting a question here. > > > > > For reference, the map and xml URLs are: > > > > >http://nsatterfield.userworld.com/AJAX_Lab10Project3_Dec12.html > > > > >http://nsatterfield.userworld.com/ajaxphone_v4.xml > > > > > The goal of the project is to enter one of 5 names and then have the > > > > location for that name show up as well as aninfowindow with the name > > > > and address. > > > > > The other 5 names/locations are also supposed to show up as click-able > > > > markers. When they are clicked, theinfowindow shows thedatafor > > > > that name. > > > > > The first part works, but when clicking on the individual markers, the > > > > only name/datathat shows up is the 5th one from the xml file. > > > > > Try entering John, Jane, or Bill to see it in action. > > > > > If anyone could point me in the right direction since I haven't found > > > > a similar post, I'd really appreciate it. > > > > > Thank you, > > > > > Neil -- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
