I have the following code to edit data with a form. I intend to load the form with a photo that I return to the database.
$(document).on('click', '.upd_uten', function(){
var id = $(this).parents("tr").attr("id");
$.ajax({
url:"updutente.php",
method:"POST",
cache: false,
data:{id:id},
dataType:"json",
success:function(data1){
for (var i = 0; i < data1.length; i++) {
Id = data1[i][0];
Imagem = data1[i][60];
$('#iduten').val(Id);
$('#uploaded_image2').val(Imagem);
}
$('#insnovu').show();
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form method="POST" class="row g-3 insnovu">
<input type="hidden" class="form-control" name="iduten" id="iduten">
<div class="col-md-12">
<div class="centrar" id="uploaded_image2" name="uploaded_image2">
<img src="../assets/utente/" class="img-thumbnail" >
</div>
</div>
</form>
This way it doesn't load the image. I've also tried inside ajax to put the following code:
$('#uploaded_image2').val('<img src="../assets/utente/',Imagem,'" class="img-thumbnail" >');
But it also doesn't load the image inside the div.
Can you help to solve the problem?