I've been working on a script for uploading images to a server. I'm curious if there's a way to modify it to use an object instead of form data and switch from POST to GET method.
var uploadfileinfo = document.getElementById("upload-file-info").value;
var file_data = $('#a_imgfile').prop('files')[0];
var a_imgfile = document.getElementById("a_imgfile");
var objData = {file: file_data};
$.ajax({
url: 'upload.php',
dataType: 'text',
cache: false,
async: false,
contentType: false,
processData: false,
data: objData,
type: 'get',
success: function (response) {
alert(response);
},
error: function(err) {
alert(err);
}
});