I am creating a file upload API.
Basically, the user will need POST files with his / her api_key + signature on my web service. Then my web service responds to a JSON response. I am wondering how this process can work asynchronously?
Assuming the user submits the request in the form, setting the target in the iframe. A JSON response will be sent to the user on his / her iframe with the content type set to "text / html". It is set as "text / html" instead of "application / json" because I want to avoid using the "pre" tag introduced by the browser around the JSON response. In any case, how does the user read the JSON response if there is a different domain in the iframe and parent window? There will be a problem with cross power.
Dynamically creating a "script" tag plus JSONP will not work in this case, because I need POST to load. JSONP only works with GET requests.
source share