繁体   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