Using jQuery val() to send form data and using FormData to send for data – Jquery ajax
I tried to send a file using an Ajax POST request using two methods: Method 1 (jQuery val()) - $.ajax({ url: 'somewhere', method: 'post', processData: true, contentType: true, data:{ 'data1': $('#fileinputid').val(), // File input } success:function(){ // Do something; }…