So I am trying to use Flask and a Javascript uploader(Dropzone) to upload files and redirect after the upload is complete. Files are getting uploaded fine, but using the traditional redirect in flask:
return (redirect (http://somesite.com))
Does nothing, page does not change. I think this is because of this: The request headers of the files being sent are set to Accept:application/json
, and the response headers are being sent in <text/html; charset=utf-8
How can I return a json response and then redirect from it? Just doing
return (redirect (jsonify(http://somesite.com)))
gives an error:
ValueError: dictionary update sequence element #0 has length 1; 2 is required
I know browsers won't redirect from Json headers anyway. How can I send the url to redirect to from Flask back to my JS app clientside and redirect from there?
I already tested this with a normal HTML form to submit the files and it worked perfectly so I'm pretty sure it is the JSON issue. Thank you.