I've a need that I didn't think to be so weird, but seeking for answer on web I realized it's a bit complicated.
I have a page with a list of documents to download, let's call it index.html
. Once a user click on a "download button", a form appears and the user's gonna be requested to provide its email. I have a proxy server file, let's name it proxy.php
, which receive an email and a document id, does some things (store the email, read document in a buffer and then provide a http-response with it) and then response with a server status and, eventually, a content.
If I use a html-form to do this, it works perfectly when nothing is wrong, but I can't intercept any exception in case of error Instead, if I use an ajax request, I can manage status codes, but I find my self with my document stored in a javascript variable and I don't know how to use it.
Thanks