1👍
✅
For the simple answer, you don’t. Send your form into an hidden iframe and and let the javascript call its parent window.
Since file uploading occurs through an iframe, traditional response data such as HTTP status codes are not directly available, and connection manager cannot reasonably discern success or failure (except a transaction timeout). Instead, the callback’s upload handler will receive a response object containing the body of the iframe document, as a string, when the transaction is complete.
My advise is, find a decent library that does that for you and use it:
With recent browsers, it’s possible to do it without relying on an iframe: Sending multipart/formdata with jQuery.ajax
Source:stackexchange.com