Skip to content

Instantly share code, notes, and snippets.

@steve-ross
Created October 21, 2012 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steve-ross/3927019 to your computer and use it in GitHub Desktop.
Save steve-ross/3927019 to your computer and use it in GitHub Desktop.
Upload a file in couchdb with jQuery
$('#upload_file').submit(function(e){
e.preventDefault();
var data = {};
$("form :file").each(function() {
data[this.name] = this.value; // file inputs need special handling
});
$(this).ajaxSubmit({
url: database_url + '/' + $('#_id').val() ,
dataType: 'json',
success: function(responseText, statusText, xhr, $form) {
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment