AJAX file uploads in Rails using attachment_fu and responds_to_parent 1
来源:互联网 发布:淘宝中年女模特叫什么 编辑:程序博客网 时间:2024/06/06 14:20
转自:https://github.com/markcatley/responds_to_parent
说明:rails中模拟ajax方式上传文件
插件下载地址:ruby script/plugin install http://responds-to-parent.googlecode.com/svn/trunk/
Adds responds_to_parent to your controller to respond to the parentdocument of your page. Make Ajaxy file uploads by posting the form to ahidden iframe, and respond with RJS to the parent window.
Example
Controller:
class Test < ActionController::Base def main end def form_action # Do stuff with params[:uploaded_file] responds_to_parent do render :update do |page| page << "alert($('stuff').innerHTML)" end end endend
main.rhtml:
<html> <body> <div id="stuff">Here is some stuff</div> <form target="frame" action="form_action"> <input type="file" name="uploaded_file"/> <input type="submit"/> </form> <iframe id='frame' name="frame"></iframe> </body></html>
0 0
- AJAX file uploads in Rails using attachment_fu and responds_to_parent 1
- AJAX file uploads in Rails using attachment_fu and responds_to_parent2
- rails update table using ajax
- Struts 2 File Uploads
- rails ajax and csrf
- rails yaml with expression or variable (Using ERB in YAML Configuration File)
- PHP文件上传(File Uploads)
- Obtaining (and managing) file and folder icons using SHGetFileInfo in C#
- Filters and Observers in rails
- Creating Vista Gadgets: Using HTML, CSS and JavaScript with Examples in RSS, Ajax, ActiveX (COM) and
- Difference between using bean id and name in Spring configuration file
- Ajax using XMLHttpRequest and Struts
- Using the LDF File and Old Backup File to Restore the Data Base in SQL SERVER 2005
- Using JQuery's ajax to call webservice and ashx handler in asp.net
- Send and Receive JSON objects to Web Service Methods using jQuery AJAX in ASP.Net
- Infinite Scroll To Load More Content in Webpage Using Ajax, and Jquery
- File Uploads with JAX-RS 2
- Django处理文件上传File Uploads
- Aspect
- 动态规划
- Medoo Select的使用:查询数据
- Hadoop源代码分析之Hadoop RPC(RPC和Client)
- 装饰模式
- AJAX file uploads in Rails using attachment_fu and responds_to_parent 1
- windows 组播网卡绑定,解决多网卡通信异常问题。
- 各种指针的含义
- hdu3591The trouble of Xiaoqian(多重背包)
- ubuntu环境下搭建PHP环境(LAMP)
- 小试牛刀 CSS实例教程 前言与目录
- 嘿嘿~~爱你哦
- hdu4539(状态压缩)
- DXLesson 1