What does the j function in Rails do?

后端 未结 2 1217
醉酒成梦
醉酒成梦 2021-02-04 23:37

I just came across a blog that mentions a j function in Rails. They were using it to do ajax style page updates.

$(\'#cart\').html(\"<%=j render         


        
2条回答
  •  無奈伤痛
    2021-02-05 00:15

    escape_javascript(javascript)

    Escapes carriage returns and single and double quotes for JavaScript segments.

    Also available through the alias j().

    From the the rails docs.

提交回复
热议问题