Hello everyone I have the following problem, it turns out that by means of a script I pull the info from the database and it is displayed in each input, I leave an image.
As you can see all the data is reflected less the user, I do not know if it is due to the warning that is coming out on the console.
As you can see the json is passing all the data to javascript.
and looking at what is being assigned to the input I can see that the value is passed but it is not showing.
I leave the code to see if you can help me with this error.
$(function(){
$.post("../php/llenar.php", function(data){
$("#capitan").html(data);
});
$.post("../php/tipo_user.php", function(data){
$("#tpuser").html(data);
});
$.post("../php/llenar1.php", function(data){
$("#congregacion").html(data);
});
$("#capitan").change(function(){
$.get("../php/modificar.php",{cedula: $("#capitan").val()},function(data){
$("input").removeAttr('disabled');
$("select").removeAttr('disabled');
$("#cedula").prop('disabled', true);
$("#cedula").val(data.cedula);
$("#nombre").val(data.nombre);
$("#apellido").val(data.apellido);
$("#mail").val(data.correo);
$("#usuario").val(data.user);
$("#pwd").val(data.pass);
$("#congregacion").val(data.congregacion);
},"json");
});
});
*{
box-sizing: border-box;
}
body{
font: normal 18px/3 "Fira Sans", "Heveltica Neue", sans-serif;
background: #3aafab;
color: white;
margin: 0;
}
h1{
text-align: center;
}
.form-registro{
width: 95%;
max-width: 500px;
margin: auto;
background:white;
border-radius: 7px;
}
h2.titulo{
background: deepskyblue;
text-align: center;
padding: 15px;
font-weight: 100;
font-size: 30px;
border-top-left-radius: 7px;
border-top-right-radius: 7px;
border-bottom: 5px solid crimson;
}
h2{
background: deepskyblue;
text-align: center;
padding: 15px;
font-weight: 100;
font-size: 30px;
border-top-left-radius: 7px;
border-top-right-radius: 7px;
border-bottom: 5px solid crimson;
}
.contenedor-input{
padding: 10px 30px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
input{
margin-bottom: 15px;
padding: 15px;
font-size: 16px;
border-radius: 3px;
border: 1px solid darkgrey;
}
.input-48{
width: 48%;
}
.input-100{
width: 100%;
}
select
{
margin-bottom: 15px;
padding: 15px;
font-size: 16px;
border-radius: 3px;
border: 1px solid darkgrey;
}
.btn-enviar{
background: crimson;
color: white;
margin: auto;
padding: 10px 40px;
cursor: pointer;
}
.btn-enviar:active{
transform: scale(1.05);
}
.contenido{
width: 80%;
margin: 0 auto;
display:grid;
}
<!DOCTYPE html>
<html lang = "es">
<head>
<meta charset = "UTF-8">
<title id="usuario"></title>
<link rel="stylesheet" href="../css/reg.css">
<script src = "../js/jquery-3.2.1.min.js"></script>
<script src = "../js/alertas.js"></script>
<script src = "../js/modificar_Cap.js"></script>
</head>
<body>
<form method= "post" class = "form-registro">
<h2> Modificar capitanes</h2>
<div class ="contenedor-input">
<select name = "capitan" id = "capitan" class = "input-100">
</select>
<input type = "text" id = "cedula" name = "cedula" placeholder = "Cedula" class = "input-100" disabled = false/>
<input type = "text" id = "nombre" name = "nombre" placeholder = "Nombres" class = "input-48" disabled = false/>
<input type = "text" id = "apellido" name = "apellido" placeholder = "Apellidos" class = "input-48" disabled = false/>
<input type = "email" id = "mail" name = "mail" placeholder = "Correo electronico" class = "input-100" disabled = false/>
<input type = "text" id = "usuario" name = "usua" placeholder = "Usuario" class = "input-48" disabled = false/>
<input type = "text" id = "pwd" name = "pwd" placeholder = "Contraseña" class = "input-48" disabled = false/>
<select type = "text" id="congregacion" name = "congregacion" placeholder = "Congregacion" class = "input-100" disabled = false/>
</select>
<select type = "text" id="tpuser" name = "tpuser" placeholder = "Tipo de usuario" class = "input-100" disabled = false/>
</select>
<input type = "button" value = " Modificar capitan" class = "btn-enviar" id = "btn-enviar"/>
</div>
</form>
</body>
</html>
and this is PHP
<?php
include("conex.php");
$cedula = $_GET['cedula'];
$sql = "SELECT nombre_hermano, apellido_hermano, correo, user, pass, nombre_congregacion, descripcion FROM hermanos,congregacion, tipo_usuario WHERE cedula = '$cedula' AND congregacion.id_congregacion = hermanos.id_congregacion AND tipo_usuario.id_tipo = hermanos.id_tipo";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result);
echo json_encode(array("cedula"=>$cedula,"nombre"=>$row['nombre_hermano'], "apellido" =>$row['apellido_hermano'], "correo"=>$row['correo'], "user"=>$row['user'], "pass"=>$row['pass'], "congregacion"=>$row['nombre_congregacion'], "descripcion"=>$row['descripcion']));
?>
I would appreciate your help