ajax获取js请求(在rails中的js.erb) - url /命名问题
在我的个人资料/ index.html.haml中,
我有
:javascript
$(document).ready(function(){
$('#clickablething').click(function() {
$.get('/profile', {**passed in json data**}, null, 'script');
})
});
当click事件发生时调用我的index.js.erb
。但是我想知道如何重命名.js.erb
文件。只有/profile
(或./profile
,或profile
)才能专门拨打index.js.erb
。如果我重命名文件profile.js.erb
它不起作用(我已经尝试将网址设置为profile.js
,profile.js.erb
,profile/profile.js
和其他变体,但这些都是无效请求,如firebug显示。
基本上我想说index.js.erb
profile.js.erb
或其他什么,我想知道如何在我的get
电话中引用它。
谢谢!!
编辑:这对我来说非常重要,因为我有2个以上的js.erb文件,我想在不同的事件发生时通过ajax GET调用。所以我不能只坚持一个index.js.erb。我该怎么做呢?什么是ajax呼叫onescript.js.erb
和anotherscript.js.erb
?
没有找到相关结果
已邀请:
3 个回复
末钉蹈泰唬
完成后,您可以再试一次。
骂狮淋唐便
艾食魄轻县