wierd problem with $.each
data.items is an array from an ajax request which returns a json.
alert(data.items.length) before of this snippet returns 12, which is correct.
- alert(data.items.length)
- $.each(data.items,function(index, item){
- //alert(item)
- if (!$.isArray(item)) {
-
- arr = hashtoArray(item);
-
- } else {
-
- arr = item;
-
- }
- first = arr.shift();
-
- if (first.indexOf('Cat') > -1) {
- $("#desf").append(first + " ");
- $('#desf').append(arr.join(',') + '<br/>\n');
- } else {
- $('#desf').append(first + "," + arr.join(',') + '<br/>\n');
- }
-
-
- });
-
- However in the #desf id i only get 8 array's displayed. However as i said in the beggining there should be 12!!! Where are the other 4??? In another page this snippet works ok!! In the same browser.
- Thanks for the help!