我使用Rails中的Ajax来实现发帖子自动追加到table中,从而不必刷新真个页面的功能,在自己的机子上好
用,在别的机子上试了,需要手工刷新才能看到追加的那行。不知道是为什么?
<table id="posts" class="around">
//other codes...
<%= render(:partial => 'post',:collection => @posts )%>
</table>
//other codes...
<% form_remote_tag(:url => { :action => 'add_post',:topic_id => @topic},
:update => "posts",
:position => :bottom ,:before => fckeditor_before_js('post', 'body')) do %>
<%= fckeditor_textarea('post', 'body',
{ :toolbarKit => 'Simple', :width => '100%', :height => '400px',:ajax => true }) %>
<p align="center"><%= submit_tag "提交",:id => 'form-submit-button' %></center>
<% end %>
_post.rhtml
<tr>
<td width="25%" class="col2"><%= post.user.display_name %><br/>
<img src="/images/photo.gif"/><br/>
上次在(<%= post.user.last_login_at.strftime("%Y-%m-%d %H:%M:%S") %>)到本站一游
</td>
<td width="75%" class="col1"><%= post.body %></td>
</tr>
分享到:
- 2007-05-07 15:32
- 浏览 3465
- 评论(3)
- 论坛回复 / 浏览 (3 / 3757)
- 查看更多
相关推荐
从事RAILS开发的人员如何使用AJAX. Learn to build dynamic, interactive web applications using the two most important approaches to web development today: Ajax and the phenomenally efficient Ruby on ...
Ajax on Rails 的 PPT。 pdf格式。
Ajax-rails-ajax-demo.zip,ruby on rails的ajax演示项目,ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、json、xml和javascript。它用于创建动态网页,其中网页的小部分在不重新加载网页的...
Beginning Google Maps Applications with Rails and Ajax, From Novice to Professional
ajax on rails压缩包,全英文
Rails 为 Ajax 而内置集成的 Prototype.js 库可以轻松快速地创建所谓的富 Internet 应用程序。 本文将逐步引导您创建 Rails 应用程序。然后深入分析如何利用 Ajax 特性编写从服务器上读写数据的 JavaScript 代码。 ...
Beginning Google Maps Applications with Rails and Ajax.pdf
Beginning Google Maps Applications with Rails and Ajax: From Novice to Professional
Beginning Google Maps Applications with Rails and Ajax: From Novice to Professional
Ajax-Rails-4-AJAX-Form.zip,rails 4 ajax表单示例,ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、json、xml和javascript。它用于创建动态网页,其中网页的小部分在不重新加载网页的情况下...
比较实用的rails的ajax框架,rails里面封装了很多比较好用的ajax方法,上手很快
您一定知道Ajax是这样一种编程技术,它使用XML、JavaScript和Web标准来创建高度交互性的Web页面,正如您在Google Maps和大量其他站点上所看到的页面那样。对Ajax这种使Web页面更具交互性的技术的大肆宣传已成过度之...
《Rails之道》详细讨论了Rails的程序代码并通过分析Rails中的代码片段来深入解释它的功能,同时,《Rails之道》部分章节也摘录了一些API文档中的内容,使读者能够快速地找到对应的API文档、相关的示例代码以及深入...
跨越边界 Ajax on Rails(英文版)
NULL 博文链接:https://zyn-zyn.iteye.com/blog/1163143
Ajax-ajax-datatables-rails.zip,datatable的ajax方法的包装器,允许在rails应用程序中与服务器端分页同步,ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、json、xml和javascript。它用于创建...