I have a problem with the selects in jQuery DataTables. The first page loads the selections well but the second does not. Sometimes it loads them, others not
$.ajax({
type: "POST",
url: "Compensaciones.aspx/getTipoConceptoComp",
data: "{p_IdTipoTributo: '" + $("#<%=ddlTipoTributo.ClientID %>").val() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data, st) {
if (st == 'success') {
if (data.d.length > 0) {
dropdownlist = $('#Detalledet select').empty().append('<option selected="selected" value="0">SELECCIONE</option>')[i];
$.each(data.d, function() {
dropdownlist = $('#Detalledet select').append($("<option value=" + this['IDTIPOCONCEPTO'] + "></option>").val(this['IDTIPOCONCEPTO']).html( /*this['CONCEPTO'] + " - " + */ this['DESCRIPCION'] + " " + this['IMPACTO']))[i];
});
} else {
dropdownlist = $('#Detalledet select').empty().append('<option selected="selected" value="0">Not available<option>')[i];
}
}
},
failure: function(data) {
alert(data.d);
}
});
I was able to solve it by calling the function in the drawcallback of the table thanks to all who took the trouble to answer