Guest User

Untitled

a guest
Jul 7th, 2020
8
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $("#someid").on("submit", function (e) {
  2.  
  3. var formData = new FormData(this);
  4.  
  5. $(".progress").show();
  6.  
  7. $.ajax({
  8. type: "POST",
  9. url: "somefile.php",
  10. xhr: function () {
  11. //var myXhr = $.ajaxSettings.xhr();
  12. //if (myXhr.upload) {
  13. // myXhr.upload.addEventlistener("progress", progress, false);
  14. //}
  15. //return myXhr;
  16. },
  17. data: formData,
  18. context: this,
  19. cache: false,
  20. contentType: false,
  21. processData: false,
  22. dataType: 'json',
  23. success: function (data) {
  24. $(".progress").hide();
  25.  
  26. }
  27. });
  28.  
  29. e.preventDefault();
  30.  
  31. });
RAW Paste Data