Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

77
Views
Upload photo to form in ajax

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!