Next Person,
I have a form to upload any image ...
<form id="form-upload" enctype="multipart/form-data" action="url" method="post">
<input type="file" name="image" id="image" />
<input type="submit" name="salvar" value="Salvar" />
<form>
I want to put the image that was sent as background of a div in an iframe, using ajax, so I do not need to refresh the page, I would like to know a way to do this, is it really necessary to upload the image? >
My JS code:
$('#form-upload').on('submit',function (e) {
e.preventDefault();
var formData = new FormData(this);
$.ajax(
{
url: uma_url_qualquer,
type: 'POST',
data: formData,
success: function (data) {
console.log("sucesso");
},
cache: false,
contentType: false,
processData: false
});
});