0
It is the following personal, I managed to store the links of the images in the database and also stored this images in a folder of my computer. so I was wondering how can I take these images with javascript and play them on my site. More or less so I would consult these images in the bank and get the link from her, with this link I wanted to be able to play on my page starting from java script, I am getting these links with the ajax, I’m just not knowing how to pass the image to the site, the description I got, how I do it is possible to do?
$(document).ready(function(){
var imageName;
var postagens = function(){
$('#retorno').empty();
$.ajax({
method : 'GET',
url :'postagens.php',
dataType : 'json',
complete: function(dados){
response = dados.responseJSON;
for(var i = 0 ; response.length > i; i++){
//document.getElementById("retorno").innerHTML = response[i].descricao;
$('#retorno').append('<p>'+ response[i].descricao +'</p> <br>');
}
}
});
}
});
</div>
<div>
<form id="conteudo" >
<div class="form-group">
<label for="exampleTextarea"></label>
<textarea class="form-control" id="exampleTextarea" rows="3"></textarea>
</div>
<button type="submit" class="btn btn-primary" id="btnPostar" name="btnPostar" >Postar</button>
<input type="file" name="btnImage" id="btnImage" class="btnImage" accept="image/*">
<hr size="1">
<p id="retorno" name="retorno" > </p> <br>
<img id="imagem" src="">
</form>
</div>
Welcome, add inside the for ,
$("#imagem").attr("src", response[i].imagem);
, but I have a question, because to be using thefor
? It is necessary for what you are doing ? For if it is only returned a result, it is not necessary to use it.– NoobSaibot
Vlw ai guy. and the for type to work as posts!!!
– Igor Martins