Bonjour,

Voici mon souci; quand je rempli mon tableau associatif mes index en double sont écrasé ( donc je n'obtiens que la derniére valeur)...

Voici mon code :

Le tableau en question est le tableau array...(faut t'il un push ? comment l'intégrer ?)...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
            var array = {};
 
            // load categoryName(select) and InterestPoints(list)
            $.ajax({
                type: "GET",
                url: '/index_points_category/', 
                dataType: 'json',
                success: function(data) {
                    $.each(data, function(key,value) {
                        var categoryName = key;
                        var arrayPoints = value; 
 
                        $.each(arrayPoints, function(index,val) {
                             array[categoryName] = val;
                         }); 
 
                        $categorySelect.append('<option value="'+ categoryName +'">'+ categoryName +'</option>');
                        $categoryForm.append('<option value="'+ categoryName +'">'+ categoryName +'</option>');
                    });
                }
            });
Cordialement

Merci