Skip to content Skip to sidebar Skip to footer

Jquery Remotipart Sending [object Object] To Server

I'm trying to upload a file to my Rails application with ajax. To facilitate this, I have included the jQuery.remotipart gem. // app/assets/javascripts/application.js //= require j

Solution 1:

After a ton of debugging and reading through lots of code, I finally have the latest gem working with Rails 3.2.8. I was nailed by three gotchas:

(1) I was disabling my file input field prior to form submission and this causes remotipart to ignore it for inclusion in the iframe submission. You must make sure your file inputs are enabled. This is the direct cause of the bug you are seeing.

(2) In the course of my debugging, I was overriding jquery.iframe-transport with the latest upstream source and it doesn't have support for the X-Http-Accepts hidden variable in the iframe. You must use the version bundled with the remotipart gem.

(3) Don't forget to wire up a callback for ajax:complete on the form if you are using a datatype other than script. This is the default if you don't specify dataType in the global ajax options, or use the data-type attribute on the form.

Post a Comment for "Jquery Remotipart Sending [object Object] To Server"