Skip to content

Instantly share code, notes, and snippets.

@kaplas
Created May 3, 2013 14:04
Show Gist options
  • Save kaplas/5509299 to your computer and use it in GitHub Desktop.
Save kaplas/5509299 to your computer and use it in GitHub Desktop.
Download a file with "AJAX" kind of POST request.
function downloadPDF(expenseClaim) {
var payload = JSON.stringify( expenseClaim );
var input = $("<input />").attr('type', 'hidden').attr('name', 'json').attr('value', payload);
var form = $("<form />").attr('method', 'POST').attr('action', context+'/generatepdf2');
form.append(input);
form.submit();
}
pdfCommandS.subscribe(downloadPDF);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment