I can not pass the variables in the ajax method.
<input type="file" id="id-input-file-2" name="arquivo" class="form-control arquivo" />
<input type="hidden" name="ID_Cotacao" id="ID_Cotacao" value="555">
.
$(function(){
$('.arquivo').change(function(e){
if ($('.arquivo').val() != "") {
e.preventDefault();
var formData = new FormData();
formData.append('arquivo', $('.arquivo').prop('files')[0]);
formData.append('nomeArquivo', $('.arquivo').val());
formData.append('id_cotacao', $('#ID_Cotacao').val());
$.ajax({
url: 'cotacoesEditarUpload.php',
data: formData,
type: 'GET',
success: function(){
alert("Enviado com sucesso."),
$(".listaArquivo").load(window.location + " .listaArquivo")
},
processData: false,
cache: false,
contentType: false
});
};
});
});
As it appears in the browser console: cotacoesEditUpload.php? [object FormData] & _ = 1441423098339
What am I doing wrong?