I am working on a website in which a user drags a file into a div, and the file is uploaded to a server running Sinatra through AJAX (XHR level 2). I want to get the response from Sinatra, as JSON, and then POST to another route with information from the JSON. This POST should result in another page being rendered.
I have got it to where I can upload the file, and get back a response. How would i do the rest?
P.S: I don’t want to use GET, because some of the information shouldn’t be in the URL.
Thanks in advance.
Not exactly the way you want. You would have to get the JSON data as string in subsequent POST call.
The idea is to create form element on the fly and use it to make subsequent POST call.
javascript code
controller code
Note you would need to replace controller code with key – values with actual use case.