How to open text files with CarrierWave and load content to textarea. (Rails)
-
25-10-2019 - |
문제
I currently have a Ruby on Rails project that has CarrierWave running on it. The project allows uploading of text files.
I'm stumped, though.
How can I open these files and put their text content into an HTML textarea element?
해결책
The solution I was looking for was very simple. I used jQuery's ajax method "get()". This method accepts a URL to a file (text file in this case) and then does some action. So, for a textarea, this action would include setting the textarea's val to the data the get() method retrieves.
제휴하지 않습니다 StackOverflow