[英]rails and load file using jquery
Hello I am using rails framework and I want to load this simple file using jquery. 您好,我正在使用Rails框架,我想使用jquery加载此简单文件。
I got my index.html.erb 我得到了index.html.erb
<div class="letters">
<div class="letter" id="letter-a">
<h3><a href="entries-a.html">A</a></h3>
</div>
<div class="letter" id="letter-b">
<h3><a href="entries-b.html">B</a></h3>
</div>
<div class="letter" id="letter-c">
<h3><a href="entries-c.html">C</a></h3>
</div>
<div class="letter" id="letter-d">
<h3><a href="entries-d.html">D</a></h3>
</div>
</div>
and my application.js 和我的application.js
$(document).ready(function() {
$('#letter-a a').click(function(event) {
event.preventDefault();
$('#dictionary').load('a.html');
});
});
the question is, where should I put my a.html? 问题是,我应该将a.html放在哪里? I tried to put in the same folder as index.html.erb but it doesnt work, why? 我试图将与index.html.erb放在同一文件夹中,但是它不起作用,为什么? Thanks. 谢谢。
您可以将a.html放在public
目录中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.