It is that I need to send a preview of an image in a div in specific, taking the route of the image stored in the database and for this run a successful Ajax send the image.
success: function(respuesta) {
var preview = document.getElementById("archivoRadicado").value = respuesta;
$('#vistaPrevia').innerHTML = '<embed src="'+preview +'"/>';
},
error: function(xhr,err) {
alert("Error");
}
And the <embed />
html control the path to receiving the route but I did not get anything, no errors or éxtito, I can do or have mistake?
This is where you should go div preview
<div id="vistaPrevia" style="width=100%; height:490px;">
</div>
You have to be sure you write CLEAN code. For starters, the following line is not valid.
<div id="vistaPrevia" style="width=100%; height:490px;">
Secondly, you're mixing up jquery and javascript. Stick to one, either jquery or javascript, since you have to initiate either one or the other, I believe, at least to my understanding, that you mustn't mix languages like this. If you decide to use jquery, change this line...
$('#vistaPrevia').innerHTML = '<embed src="'+preview +'"/>';
...to this
$('#vistaPrevia').html('<embed src="'+ preview +'"/>');
Hope this helps.