Hello!
I created service (screen in attachments) - http://www.goldbeltbyway.com/api/feed...
How can I get length of array? On responce mapping I use this code:
//tour_cluster
if (value.field_cluster_tour_nids) {
Code: Select all
var itemCount = value.field_cluster_tour_nids.field_cluster_tour_nid.length;
console.log('itemCount : ' + itemCount);
for (var i = 0; i < itemCount; i++)
{
var tourID = value.field_cluster_tour_nids.field_cluster_tour_nid[i];
console.log('tour: ' + tourID + ' cluster: ' + value.nid);
//fillTourClusterWithValues (tourID, value.nid);
} // end for
}
For ID 108 count is 2, BUT..... for 107 is two also! I noticed, that for 107 element is STRING, not array. Why? What is the correct way? log in attachments.
Thanks!