'select2 fill when saving a new customer

I wish when saving a new client in the modal the fields of the invoice are automatically placed as you can see in the example of name email address

The only field that I need to fill in is the select2 that I am using, it comes out empty

$.ajax({
  url: "/Clientes/nuevo",
  type: "POST",
  data: datos,
  success: function (response) {
    if (response == "success") {
      Swal.fire({
        position: "center",
        icon: "success",
        title: "Se ha registrado al usuario correctamente",
        showConfirmButton: true,
        timer: 1500,
      }).then((result) => {
        if (result.isConfirmed) {
          $("#cliente").select2("destroy");
          $("#cliente").val(datos.cedula);
          $("#nombres").val(datos.nombre);
          $("#correo").val(datos.email);
          $("#direcciones").val(datos.direccion);
        }
      });
    } else {
      Swal.fire({
        icon: "error",
        title: "Error",
        text: "Error al registrar al usuario, comuniquese con el area de sistema",
      });
    }
  },
});

example1

example2



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source