Jquery / Forms / File Uploading using ajax
Ajax File Upload
-
STEPS
in html
in script
$('#submit').click(function(){ var files = $('#file')[0].files; if(files.length > 0){ var fd = new FormData(); // Append data fd.append('file',files[0]); fd.append('_token',CSRF_TOKEN); // Hide alert $('#responseMsg').hide(); // AJAX request $.ajax({ url: "", method: 'post', data: fd, contentType: false, processData: false, dataType: 'json', success: function(response){ }, error: function(response){ } }); } }); OR