I have to retrieve an image from an existing ruby on rails backend with Javascript and show it in html.
The file is send in Image_controller with the following line:
send_file(image.path(style), type: image.content_type, disposition: 'inline')
How can I retrieve this file in javascript over the Internet an show it in my html page?
When I create a jquery request and send it to the ruby backend, I get a response in the succes function, but I don't know the format of the response data and how to show it in my html page.
All you really need to do is respond with the image url instead of sending the file. Let javascript load the image:
// javascript