title: Upload photo to form in ajax
body: <p>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.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(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 &lt; data1.length; i++) {
          Id = data1[i][0];
          Imagem = data1[i][60];
          
          $('#iduten').val(Id);
          $('#uploaded_image2').val(Imagem);        
        }
        $('#insnovu').show();
    });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;form method="POST" class="row g-3 insnovu"&gt;
   &lt;input type="hidden" class="form-control" name="iduten" id="iduten"&gt;
   &lt;div class="col-md-12"&gt;
    &lt;div class="centrar" id="uploaded_image2" name="uploaded_image2"&gt;
      &lt;img src="../assets/utente/" class="img-thumbnail" &gt;
     &lt;/div&gt;
   &lt;/div&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>This way it doesn't load the image.
  I've also tried inside ajax to put the following code:</p>
  <pre><code>$('#uploaded_image2').val('&lt;img src=&quot;../assets/utente/',Imagem,'&quot; class=&quot;img-thumbnail&quot; &gt;');
  </code></pre>
  <p>But it also doesn't load the image inside the div.</p>
  <p>Can you help to solve the problem?</p>