I have this code.
$.post("tipo_documentos/llenar_combo",{accion:''},function(data){
$("#documento").append(new Option('Seleccione',''));
for (i = 0; i < data.length; i++) {
$("#documento").append(new Option(data[i][1],data[i][0],data[i][6]));
};
//$('#documento option[value="6').prop("selected", true);
},'json');
as you will see in new option I have 3 data data[i][1]
which is the name.
data[i][0]
which is the code and data[i][6]
which is the type_document
Now I have this other code where I capture the data and show it in inputs:
$("#documento").on('change', function() {
if ($(this).val()!="") {
var codigo = $(this).val();
var nombre = $("#documento option:selected").text();
if (codigo == '07'|| codigo == '08')
{
$("#note").show();
} else {
$("#note").hide();
}
$("#nomb").val(nombre);
$("#cod").val(codigo);
$.post("ventas/datos_documento" , {Codigo:codigo,Nombre:nombre} , function(data){
$("#serie").val(data.Serie);
$("#numero").val(data.Numero);
},'json');
}else{
$("#serie").val('');
$("#numero").val('');
}
});
the var code captures the code and the var names the name but how do I capture the document type?