在軌道3.1,餘爲實現:
1.在柱控制器定義測試行動:rails 3.1:它是ajax嗎?
def test
@p = Post.first
respond_to do |format|
format.js
end
end
2.定義在routes.rb中:
resources :posts do
collection do
get 'test'
end
end
3. index.html中。後文件夾的ERB,我添加了鏈接:
<%= link_to "test", test_post_path, :remote => true %>
4.創建後文件夾中的文件test.js.erb:
code jQuery
我的問題是:「我在rails 3.1中實現Ajax嗎?」我不太瞭解rails中的ajax。
如果不是,你能給我一個關於rails 3.1中的ajax的鏈接和我設置的技術,它是什麼?