Andrew Walker
Posts: 0
Joined: Thu Dec 05, 2013 9:11 am

Use array response from an external API in Javascript

I am sure this is easy, but I have been unable to find a way, to use the REST to collect a json data set, which is returned into an array. The array has about 4 - 8 items, but I only need 2. So I want to go through each item and collect only the items with a certain type.

I can get the data set, but how I do I then run a script, using what came back in the response. Due to it being an array, I am unable to set a local storage. How do I access it in javascript ?

Hope that makes sense. Thank you

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Use array response from an external API in Javascript

Hello! On service success event you'll get entire response in data variable.

Andrew Walker
Posts: 0
Joined: Thu Dec 05, 2013 9:11 am

Use array response from an external API in Javascript

Yea, I can see that, the array is called 'areas'. But I am unable to use it in Javascript. How I do access it in Javascript ?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Use array response from an external API in Javascript

On service success event all data is returned to 'data' variable. Use this 'data' variable, not 'areas'.

Return to “Issues”