开发者

Rails 3 - AJAX request

Rename it

rename.开发者_高级运维js.erb

alert('start');
$('div.popup').html('<%= escape_javascript(render('rename')) %>');

_rename.html.erb

Some text

in terminal window Processing by ArticlesController#rename as ...

Rendered articles/_rename.html.erb (0.3ms) Rendered articles/rename.js.erb (2.3ms)

This is my current set up for the AJAX request. I'm still getting this error message *Missing template articles/rename *. I don't understand why, I think everything should be set alright... jQuery library is loaded. The alert window in JS file don't jump... Could anyone help me, please, what is the problem?


Can you post the full terminal output for that request? I'm interested in where Rendered articles/_rename.html.erb (0.3ms) is coming from and what it's being processed as since you simply wrote "...".

The only thing I can think of is that your file isn't named correctly.

ArticlesController#rename would look for rename.html.erb and not a partial like _rename.html.erb.


Try rendering _render.html.erb explicitly as a partial within your js file. Rails might be getting confused with the (almost) conflicting names of your views.

In rename.js.erb

$('div.popup').html('<%= escape_javascript(render(:partial => 'rename')) %>');

Or try renaming the partial other than rename.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜