bug avec getJSON() sous jquery 1.4.1
Bonsoir, afin de passer vers cette nouvelle mouture en douceur, j'ai commencer par vérifier chaque exécution de script.
Seulement, j'ai un petit script qui rempli un select via une requête json et qui fonctionne très bien avec jquery 1.3.2.
Depuis le passage vers la 1.4 le script ne fonctionne plus correctement.
Dans firebug je vois bien la requête mais le select n'est jamais rempli.
Voici le script :
Code:
1 2 3 4 5 6 7 8
| $("select#idclc").change(function(){
$.getJSON("/json/getidclc="+ $(this).val(),function(j){
var options = '<option value="0">Aucune sous-catégorie</option>';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
$("select#idcls").html(options);
}); |
LE html ce présente comme ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| <tr>
<td class="label"><label for="idclc" class="inlinelabel">Catégorie :</label></td>
</tr>
<tr>
<td><select id="idclc" name="idclc" class="select">
<option value="0">Aucune catégorie</option>
<option value="1">maison à vendre</option>
<option value="2">vente chateau</option></select>
</td>
<tr>
<td class="label"><label for="idcls" class="inlinelabel">Sous catégorie :</label>
</td>
</tr>
<tr>
<td>
<select id="idcls" name="idcls">
<option value="">Sélectionner une catégorie</option>
</select>
</td> |