JangoSteve / remotipart

Rails jQuery file uploads via standard Rails "remote: true" forms.
http://os.alfajango.com/remotipart
Other
1k stars 215 forks source link

JSON returning a textarea? Also, typo in your jQuery example...and not working for me when fixed #137

Closed gregblass closed 8 years ago

gregblass commented 8 years ago

For some reason my JSON response is being wrapped in a textarea. I looked around at some issues here but it was hard for me to figure out what the status is with that, or if I can just have simple JSON returned.

Also, you have a typo on your documentation:

$(form).on("ajax:remotipartComplete", function(e, data){
  console.log(e, data)
});

You need quotes around "form".

But even when I put quotes around it, I get nothing firing off with that code.

This for now has led me to keep looking for another solution, but I'm all ears if anyone has any insight!

chrisbloom7 commented 8 years ago

The text area was addressed in https://github.com/JangoSteve/remotipart/pull/126, which has been accepted for a while now but is still unreleased. Until then, just create an initializer and drop the following into it:

module Remotipart
  module RenderOverrides
    # RADAR Temporary override until 
    # https://github.com/JangoSteve/remotipart/pull/126 is resolved
    def render_with_remotipart *args
      render_without_remotipart *args
      response_body
    end
  end
end
gregblass commented 8 years ago

Cool, thanks. I ended up just using jquery-file-upload which does what I needed.