I am using prototype 1.6.0.3. All I am trying to do is get the
results from evalJSON and iterate through them. I have an Ajax
request, and on success it does something like:
thisObj.adjustResultsForMovement.bind(thisObj,
transport.responseText.evalJSON(true))();
So far, nothing works. Right now I am just doing some debug output.
First I tried:
adjustResultsForMovement: function(newMarkers) {
// add results not currently on map
debugMessage(' -- adding -- ')
for (var newLocId in newMarkers) {
if (typeof this.currentMarkers[newLocId] ==
'undefined') {
debugMessage('adding: '+newLocId+' -
'+newMarkers
[newLocId].latitude+' '+ newMarkers[newLocId].longitude +
newMarkers[newLocId].full_address);
}
}
// remove results no longer needed
for (var existingLocId in this.currentMarkers) {
if (typeof newMarkers[existingLocId] == 'undefined') {
debugMessage('removing: '+existingLocId);
}
}
That iterates over all of the functions too, which I don't want.
Then I tried:
adjustResultsForMovement: function(newMarkers) {
newMarkers = $H(newMarkers);
// add results not currently on map
debugMessage('-- adding results --');
var adder = function(newMarker, newLocId) {
debugMessage('add iterating: marker: '+newMarker+'
locid:
'+newLocId);
}
newMarkers.each(adder);
Which still iterates over all of the functions in the Hash.
How am I supposed to iterate over just the data items in newMarkers?
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.