Bonjour,

j'ai un probl�me et je ne suis pas du tout bon en js. Si vous pouvez m'aider ce serait cool.
J'aimerais savoir comment on fait pour injecter dans une row dynamic un dropdown comportant des langue.
En statique, pas de probl�me, mais la je plante.

Peux �tre en ajax ? Mais la aussi comment fait on ?

Merci

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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
<?php
        $test = Language::getLanguages();
// J'ai essayé ceci mais cela ne fonctionne pas.
        foreach ($test as $toto) {
          $lg .= '<option id="language" value="' . $toto['id'] . '"></option><option value="' . $toto['name'] . '"></option></select>';
         }
 
      $output = <<<EOD
 
 
<script>
$(document).ready(function () {
  var counter = 0;
 
  $("#addrow").on("click", function () {
      var newRow = $("<tr>");
      var cols = "";
 
      cols += '<td><input type="text" class="form-control" name="user_question[]' + counter + '"/></td>';
 
 
 
//le problème est ici : Dropdown     
      cols += '<td><select name="language[]' + counter + '" id="language" placeholder="Language" class="form-control">{$lg}</select></td>';
 
 
 
      cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger" id="delete_row" value="{$button_delete}"></td>';
 
      newRow.append(cols);
      $("table.order-list").append(newRow);
      counter++;
  });
 
  $("table.order-list").on("click", ".ibtnDel", function (event) {
    $(this).closest("tr").remove();       
    counter -= 1
  });
});
 </script>
EOD;
        return $output;