"phone/phone_fields" , :phone => @phone ,:tok...">

Rails: Render in * .js.erb not executing

I have this code in js.erb file

$("<%=j render(:partial => "phone/phone_fields" , :phone => @phone ,:token => tokenizer, :exists => false) %>").hide().appendTo('.contacts').slideDown(); 

The controller that calls it passes the @phone variable, and the tokenizer is an assistant. If I make a tokenizer and @phone as a warning, this works, but when I use it inside the render statement, it does nothing. This is not done at all. He doesn't even give a mistake or anything like that.

I tried a lot of options, such as calling the js render operator inside the controller, and the result is passed to the js file and still does not work. But I was wondering why this works in one of my assistants.

+4
source share
1 answer

Try this by partially deleting the "js.erb" files:

 <%= escape_javascript(render(:partial => "phone/phone_fields", :phone => @phone ,:token => tokenizer, :exists => false)) %> 
0
source

Source: https://habr.com/ru/post/1446749/


All Articles