Solved! Go to Solution.
I'm loading a bunch of points from JSON when my map loads. I create a graphic for each from a lat/lon pair. When a user clicks a point, I'd like to fire off a query based on a custom ID attribute I store with the graphic. I'd like to make a JSON request to the same server and pull back another JSON object to populate the infoWindow.
My problem comes in because due to the async nature of Javascript, my "details" JSON object isn't ready while creating the initial info Template. I can't find an event to latch onto to fire off the query.
I'm loading a bunch of points from JSON when my map loads. I create a graphic for each from a lat/lon pair. When a user clicks a point, I'd like to fire off a query based on a custom ID attribute I store with the graphic. I'd like to make a JSON request to the same server and pull back another JSON object to populate the infoWindow.
My problem comes in because due to the async nature of Javascript, my "details" JSON object isn't ready while creating the initial info Template. I can't find an event to latch onto to fire off the query.
An option could be to reorganise your points into a featureLayer based on a featureCollection, as explained at http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/featurelayer.html#featurelayer2
If you were able to load the "details" object from the original JSON at the same time, there'd be no need to make a second request for this information.
Alternatively, you'd at least have a better mechanism for tying the original point to the second JSON request, based on a common ID.