Skip to content

Instantly share code, notes, and snippets.

@anpleenko
Forked from levchik/form_file.js
Last active August 29, 2015 14:17
Show Gist options
  • Save anpleenko/03f90efb62845d39e285 to your computer and use it in GitHub Desktop.
Save anpleenko/03f90efb62845d39e285 to your computer and use it in GitHub Desktop.
$('form').submit(function(){
event.preventDefault();
var fd = new FormData($('.employee-file-form')[0]);
var btn = $(this).find('.js-upload-field-employee');
btn.button('loading');
$.ajax({
url: '/api/v3/upload_field_employees/',
type: 'POST',
data: fd,
cache: false,
contentType: false,
processData: false,
success: function(response){console.log(reponse);},
}).always(function() {
btn.button('reset');
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment