转自: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::Basedef mainenddef form_action# Do stuff with params[:uploaded_file]responds_to_parent dorender :update do |page|page << "alert($('stuff').innerHTML)"endendend
end

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>

AJAX file uploads in Rails using attachment_fu and responds_to_parent 1相关推荐

  1. AJAX file uploads in Rails using attachment_fu and responds_to_parent

    http://khamsouk.souvanlasy.com/articles/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_ ...

  2. html5支持ajax和jQuery吗,使用HTML5文件上传与AJAX和jQuery(Using HTML5 file uploads with AJAX and jQuery)...

    使用HTML5文件上传与AJAX和jQuery(Using HTML5 file uploads with AJAX and jQuery) 诚然,Stack Overflow上有类似的问题,但似乎并 ...

  3. rails应用ajax之二:使用rails自身支持

    考虑另一种情况: 1. 页面上半部分显示当前的所有用户,页面下半部分是输入新用户的界面: 2. 每当输入新用户时,页面上半部分会动态更新新加用户的内容: 我们还是用ajax实现,不过这次用rails内 ...

  4. jquert ajax文件 mvc,jquery ajax file upload NET MVC 无刷新文件上传

    //MVC实现 public classFileController : Controller { [HttpPost]publicActionResult Setting() {string use ...

  5. 专业ajax解决方案汇集

    Smashing Magazine给出了85个专业ajax解决方案,它们几乎涵盖了所有的ajax使用场景,而且个个都带图,选你喜欢的,然后下载示例代码就是了! AJAX Auto Completer ...

  6. 常用ruby gem

    常见gems: Devise 用于快速构建用户功能,如:注册,登陆,个人设置,找回密码 oauth OmniAuth 如果你需要在项目中实现三方平台(如: Twitter, Facebook, 新浪微 ...

  7. java ajax多文件上传插件_jQuery Upload File 多文件批量上传插件 - 资源

    jQuery File UPload 包含多个带有进度条的文件上传,能够兼容任意的服务端语言,例如 PHP.Python.Ruby on Rails.Java等,支持标准的HTML表单文件上传.jQu ...

  8. ajax upload file.js,jquery.ajaxfileupload.js

    jquery.ajaxfileupload.js上传插件,利用iframe提交不刷新页面功能完成. /* // jQuery Ajax File Uploader // // @author: Jor ...

  9. rails 创建_使用Rails和Icecast创建在线流媒体广播

    rails 创建 Hello and welcome to this article! Today I would like to talk about creating an online stre ...

最新文章

  1. js获取当前Frame在父页面中的id
  2. 第一章 简单工厂模式
  3. python邮件发送哪个好_python发邮件(一)
  4. yolo算法_不到2MB,超轻YOLO算法!准确率接近YOLOv3,速度快上45%
  5. 委托BegionInvoke和窗体BegionInvoke
  6. SP2-0734: 未知的命令开头 imp scott/... - 忽略了剩余的行。
  7. 【WP主题】仿下载吧全开源无加密wordpress主题模板内含newzhan2.60无授权版本
  8. 深度学习(deep learning)优化调参细节(trick)
  9. 【PAT乙】1064 朋友数 (20分) set用法
  10. 线性回归学习算法c语言实现_线性搜索算法及其C语言实现
  11. 给定坐标(星期几、第几节)前端显示问题
  12. matlab 矩阵逻辑与,MATLAB矩阵的寻访与赋值
  13. 上海市计算机二级vb试题及答案,上海计算机二级VB试题
  14. linux系统怎么修改数据库密码,Linux系统修改数据库密码相关
  15. 【推荐】2022年AIOT人工智能物联网行业研究报告市场应用分析白皮书(附件中为网盘地址,报告持续更新)
  16. push代码至gitee码云报错unable to access ‘https://gitee.com/*/git/‘: The requested URL returned error: 403
  17. 域名和服务器IP地址有什么关系
  18. 使用Chrome开发者工具精确定位网页元素位置
  19. 为海思u-boot快速生成reg_info.bin文件
  20. android 蓝牙打印 js,Native.js 安卓连接蓝牙打印机【可连续打印】

热门文章

  1. PR 2019 快速入门(5)
  2. 【漏洞复现】CVE-2020-0796漏洞复现(win10系统)
  3. matlab 画三维花瓶,CAD三维花瓶的建模方法 看完你学会了么
  4. .NET 换肤软件 IrisSkin 2.0 破解版下载及多款皮肤下载
  5. 联想云闯江湖,拿手的是这“一招一式”
  6. vue中如何实时修改输入的值
  7. 微信小程序 通过nodeJs操作MySQL进行数据交互
  8. Freebsd 4.7环境下基于qmail系统的反病毒反垃圾邮件系统构建--fw
  9. sqlserver处理千分符
  10. Shell 获取本机IP