19e786a2a74377ff6e052d87fd8d1fa8

使用 remotipart 讓 :remote => true 與 :multipart => true 共存

xditeRuby 節點 中發起
最後由 匿名 於回應 , 528次閱讀

最近在寫一個小玩具時,想要上傳之後繼續 AJAX 的動作。
卻發現一直 406..

丟關鍵字下去找,才發現一件事實...

http://stackoverflow.com/questions/4009252/is-it-possible-in-rails3-to-have-a-multipart-form-true-use-remote-true

The thing is that you cannot post a multipart form via AJAX. This is not a rails' limitation. In order to circumvent this, you need to use an iframe technique (which can be easier with responds_to_parent plugin) or use a technology like Flash or Silverlight.

可惡,讓我 debug 那麼久才發現這是 javascript 限制...

不過後來下面有好心鄉民提供了解決方法。可以用一樣的 API 硬幹...

http://github.com/leppert/remotipart

暫無回應。
需要 登入 後方可回應,如果你還沒有帳號按這裡 註冊