bonsoir j'ai un probl�me avec la r�cup�ration des valeurs des checkbox s'il sont checked
dans le fichier attach� vous trouvez la capture d'�cran d'un tableau g�n�r� par une r�sultat d'ajax mais le probl�me que j'ai essay� d'avoir la valeur d'un checkbox
mais tous les codes ont ramen� � des �checs .
voil� la fonction qui retourne le r�sultat (ajax)
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
| $('.clientcomm').on('change',function(){
tabl=$(this).attr('index');
var Tbl = document.getElementById('addtable');
while(Tbl.childNodes.length>2){Tbl.removeChild(Tbl.lastChild);}
idclient=$(this).val();
$.ajax({
url: wr+"Reglements/affichercommande/"+idclient,
dataType:"json",
}).done(function(data){
// console.log((data.commandes[0][0]));
for(i=0;i<(data.commandes).length;i++ )
{
if(data.commandes[i][0]['etat']=="0"){
text='<font color="red">Non Payé</font>';
check='<input type="checkbox" name="data[Commandes]['+i+'][etat]" value="1" class="checkmont" index="'+i+'" id="paiement'+i+'"';
}
else
{
text='<font color="green">Payé</font>';
check='';
}
$('#addtable').append('<tr>\n\
<td align="center" nowrap="nowrap"><input type="text" value="'+data.commandes[i][0]['id']+'" class="form-control col-sm-12" name="data[Commandes]['+i+'][id]" readonly id="cmd'+i+'" > </td>\n\
<td align="center" nowrap="nowrap"><input type="text" value="'+data.commandes[i][0]['date']+'" class="form-control col-sm-12" name="data[Commandes]['+i+'][date]" readonly id="datecmd'+i+'" ></td>\n\
<td align="center" nowrap="nowrap"><input type="text" value="'+data.commandes[i][0]['acompte']+'" class="form-control col-sm-12" name="data[Commandes]['+i+'][acompte]" readonly id="acomptecmd'+i+'" ></td>\n\
<td align="center" nowrap="nowrap"><input type="text" value="'+data.commandes[i][0]['total']+'" class="form-control col-sm-12" name="data[Commandes]['+i+'][total]" readonly id="totcmd'+i+'" ></td>\n\
<td align="center" nowrap="nowrap"><input type="text" value="'+Number(parseFloat(data.commandes[i][0]['total'])-parseFloat(data.commandes[i][0]['acompte'])).toFixed(3)+'" class="form-control col-sm-12" name="data[Commandes]['+i+'][total]" readonly id="totcmd'+i+'" ></td>\n\
<td align="center" >'+ text+' </td> \n\
\ <td align="center" >'+ check+' </td> \n\
</tr>');
}
});
}); |
Partager