Why is my closure variable cleared after using $.each on JSON data?

The $. GetJSON call is asynchronous, so annotationLayer. AddFeatures is probably being executed before the JSON request has finished.

Call the addFeatures method inside the $. GetJSON call, after the each loop.

The $. GetJSON call is asynchronous, so annotationLayer. AddFeatures is probably being executed before the JSON request has finished.

Call the addFeatures method inside the $. GetJSON call, after the . Each loop.

If you need to perform more stuff with features, consider creating a new function (which includes the addFeatures method you need to call), and then call this new function after the . Each loop inside the $. GetJSON call.

This is to do with the asynchronous behaviour of the $. GetJSON function. Move annotationLayer.

AddFeatures(features); inside the $. GetJSON function. The features variable isn't being "cleared"; rather, it has not being populated when annotationLayer.

AddFeatures(features); is executed.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions