nested calls,second done not firing

nested calls,second done not firing

hi all,
I've written this piece of code:

  1. if ($('#smartcards').val()) {

    let customer_id = $('#customer').val();
    let customer_name = $('#customer option:selected').text();
    if ($('.shipment-edit').length) {
    customer_id = $('#hcustomer').val();
    customer_name = $('#customer').val();
    }
    $.ajaxSetup({
    headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
    });
    $.ajax({
    method: 'POST',
    url: '/manufacturers/checksmartflag',
    data: {
    id: customer_id
    }
    })
    .done(function (data) {

    if (data == '1') {
    if (confirm('Vuoi bloccare le smart per il produttore ' + $('#customer option:selected').text() + '?')) {
    $.ajax({
    method: 'POST',
    url: '/manufacturers/smartflag',
    data: {
    id: customer_id
    }
    })
    .done(function (data) {
    alert(data)
    if (data == '0') {
    alert('Il produttore ' + customer_name + ' ha ora il cambio smart bloccato');
    }
    });
    }
    }
    });
    }
what is happening is when I confirm the dialog box, the second calls works (I see value changing in the db), but the second .done() is not fired (no alerts at all). How can this be?
Thanks a lot