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 44 45 46
| $(function () {
$('.error').hide();
$.ajax({
type: "POST",
url: "Edit_couleur.aspx/GetGrossistes",
data: '{"PageEnCours":"' + document.location.href.toString() + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
$('#lstGrossistes').append($('<option>', { value: "-1", text: "Sélectionnez un grossiste" }));
if (msg.d != null) {
$.each(msg.d, function (i, item) {
$('#lstGrossistes').append($('<option>', { value: item.IdGros, text: item.Libelle }));
});
}
},
error: function () {
alert('oups');
}
});
var CtrlGros = $('#lstGrossistes option:selected');
var Gros = CtrlGros.val();
$('#lstGrossistes').change(function () {
if (Gros == "-1") {
$('#divcouleur').html("");
}
else {
$.ajax({
type: "POST",
url: "Edit_couleur.aspx/GetCouleur",
data: '{"IdGros":' + Gros + ',"PageEnCours":"' + document.location.href.toString() + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
BuildTable(msg);
}
});
}
});
}); |
Partager