Skip to content

Instantly share code, notes, and snippets.

@carloswm85
Last active July 12, 2022 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carloswm85/6e45ac72dadb668d608f0e1e2da748d5 to your computer and use it in GitHub Desktop.
Save carloswm85/6e45ac72dadb668d608f0e1e2da748d5 to your computer and use it in GitHub Desktop.
$(document).ready(function () {
// Variable assignment
var $producerSelect = $('#ProducersId');
$producerSelect.on('select2:select', function (e) {
var data = e.params.data;
var idPerson = data.id;
var dataWrapper = {
idPerson: idPerson
}
$fileSelect.select2({
language: "es",
theme: "bootstrap-5",
placeholder: {
id: '0',
text: 'Seleccionar opción'
},
allowClear: true,
width: 'style'
});
$.ajax({
url: '/Checkbook/GetFileList',
dataType: "json",
async: true,
data: dataWrapper,
method: "POST",
success: function (response) {
var tempList = `<option value="${0}" name="${"NN"}" class="custom-option">${"Seleccionar expediente"}</option>`;
for (i = 0; i < response.length; i++) {
tempList += `<option value="${response[i].IdFile}" title="${response[i].ClaimName}" class="custom-option">${response[i].FileNumber}</option>`;
}
$fileSelect.empty();
$fileSelect.html(tempList);
$claimName.val("Selección automática");
},
error: function (ex) {
console.error(ex.responseText);
}
});
$fileSelect.prop("disabled", false);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment