saikishore

Get an attribute from a  json array and alert it

Discussion created by saikishore on Mar 17, 2013
Latest reply on Mar 17, 2013 by saikishore
I have a json array and im plotting an icon on the map by taking latitude and longitude from it. Now on click of that icon, i want that particular attributd to be alerted.

var locations3 = [{'latitude': 33.861269, 'longitude': -118.063548, 'address_id': 1, 'state': NY, 'address': null},
                         {'latitude': 33.858826,'longitude': -118.062749, 'address_id': 2, 'state': null, 'address': null},
                         {'latitude': 33.860903,'longitude': -118.062789, 'address_id': 3, 'state': null, 'address': null},
                         {'latitude': 33.861190,'longitude': -118.061151, 'address_id': 4, 'state': null, 'address': null},
                         {'latitude': 33.860534,'longitude': -118.06169, 'address_id': 5, 'state': null, 'address': null},
                         {'latitude': 33.860999,'longitude': -118.060164, 'address_id': 6, 'state': null, 'address': null}];

i have used dojo.foreach to plot latitude and logitude and drop an icon on the map. Onclick of the icon, i have an graphics event listener. Now, onclick of any particular icon, i want the corresponding address_id displayed (alerted).

Outcomes