Tengo problemas para mostrar el resultado de un Json, dentro de una etiqueta html: input, pero si me imprime en un: textarea y en una tabla pero no imprime dentro del input esta es mi función js:
function consultar() {
var ced = document.getElementById("cedu").value;
var gen = document.getElementById("generico").value;
var id = document.getElementById("idRepresentante").value;
$.ajax({
url: 'www/getPaso1_ConsultarIdentificacionPorGenerico.php',
data: {cedu: ced, generico: gen, idRepresentante: id},
type: 'post',
dataType: 'json',
success: function (data) {
//Muestro datos en la tabla (SI MUESTRA DATOS)
$.each(data, function () {
$('#a1').text(data.cedula);
$('#a2').text(data.cupo);
$('#a3').text(data.entrada);
$('#a4').text(data.plazo);
$('#a5').text(data.cuota);
});
//Muestro en un texarea (SI MUESTRA DATOS)
$('#j1').text(data.datosSolicitud.txtPrimerApellido);
//Muestro en un input (NO MUESTRA DATOS)
$('#j2').text(data.datosSolicitud.txtPrimerApellido);
}
}
);
}
HTML:
<textarea type="text" id="j1"></textarea>
<input type="text" id="j2">
$('#j2').val(valor);
y tú lo estás intentando context(valor)