Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(".select-zone").change(function () {
- var select = $(".select-lieu");
- var value = $(this).val();
- select.empty().append("<option value='-1'>Lieu / Salle</option>");
- if (value != -1) {
- $.ajax({
- url: Routing.generate('admin_default_getlieusallebyzone', {id: value}),
- dataType: 'json'
- }).done(function (data) {
- $.each(data, function (i) {
- $.each(data[i], function (val1) {
- var id = val1.id;
- var libelle =val1.nom;
- var numero = val1.numero;
- if (numero != undefined) {
- select.append("<option value=" + id + ">" + libelle + " - " + numero + "</option>");
- } else {
- select.append("<option value=" + id + ">" + libelle + " </option>");
- }
- });
- $.each(data[i], function (val2) {
- var id = val2.id;
- var libelle = val2.nom;
- var numero = val2.numero;
- if (numero != undefined) {
- select.append("<option value=" + id + ">" + libelle + " - " + numero + "</option>");
- } else {
- select.append("<option value=" + id + ">" + libelle + " </option>");
- }
- });
- select.prop('disabled', false);
- })
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement