Guest User

Untitled

a guest
Oct 5th, 2021
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. function ajaxCallToExpandController(requestUrl, formData) {
  2. $.ajax({
  3. url: requestUrl,
  4. type: "POST",
  5. data: formData,
  6. contentType: false,
  7. processData: false,
  8. success: function (excelByteResult) {
  9. var bytes = base64ToBytes(excelByteResult.base64String);
  10. var blob = new Blob([bytes], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
  11. const url = window.URL.createObjectURL(blob);
  12. const a = document.createElement('a');
  13. a.style.display = 'none';
  14. a.href = url;
  15. a.download = excelByteResult.excelFilename;
  16. document.body.appendChild(a);
  17. a.click();
  18. window.URL.revokeObjectURL(url);
  19. },
  20. error: function (jqXHR, textStatus, errorThrown) {
  21. console.log("Xhr: " + jqXHR.responseText);
  22. console.log("Status: " + status);
  23. console.log("Error Thrown: " + errorThrown);
  24. }
  25. });
  26. }
Add Comment
Please, Sign In to add comment