簡體   English   中英

無法在Rails中使用jQuery加載新表單

[英]Not able to load new form using jquery in rails

我正在看Ryan Bates截屏視頻http://railscasts.com/episodes/136-jquery-ajax-revised ,了解如何使用jquery在index.html.erb中加載新表格。

這是我的index.html.erb

<%= link_to 'New Mail', new_mail_path, id: "new_mail", remote: true %>

這是我的new.js.erb

$("#new_mail").hide().after('<%= j render("form") %>')

但這不起作用。 嘗試調試(在Chrome中)時,在控制台下,沒有錯誤,但是在網絡中,我看到的是“ 304 Not Modified”響應,而不是302,有什么幫助嗎?

謝謝

編輯-它的工作,我最終不得不把“format.js”在創建方法嘆息

更換

$("#new_mail").hide().after('<%= j render("form") %>')

$("#new_mail").after('<%= j render("form") %>');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM