i'm trying to make a simple form to upload files with jquery/ajax. this is a part of my code:
var formData = new FormData($(this)[0]);
$.ajax({
url: 'uploader.php',
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
success: function (data) {
$('#ShowR').html(data);
}
});
i'm trying to change this code to $.post method like this:
var formData = new FormData($(this)[0]);
$.post('uploader.php', {action:"ShowGTR",MyFiles:formData},
function(data) {
$('#ShowR').html(data);
});
i tried some ways but i couldn't fix the code and in Google Chrome console i got this error:
Uncaught TypeError: Illegal invocation
so i need your help to fix this code and convert $.ajax method to $.post method. i really appreciate if anyone can help me for this.