Raw in elixir

I encountered an error when attempting to use a raw function. The HTML contains an ID for jQuery to fetch JSON data from an API endpoint, and this HTML is raw.

<%= raw(“

Loading…

”)%>

== Compilation error in file lib/my_app_web/controllers/page_html.ex ==
** (SyntaxError) lib/my_app_web/controllers/page_html/home.html.heex:240:47: syntax error before: aboutme
|
240 | raw(“

Loading…

”)
| ^
(eex 1.15.2) lib/eex/compiler.ex:334: EEx.Compiler.generate_buffer/4
(eex 1.15.2) lib/eex/compiler.ex:357: EEx.Compiler.generate_buffer/4
(phoenix_live_view 0.19.5) expanding macro: Phoenix.LiveView.HTMLEngine.compile/1
lib/MyAppWeb/controllers/page_html/home.html.heex: MyApp.PageHTML.home/1

Hi and welcome! You simply need a space after the ) before the %.

1 Like
<%= raw(“

Loading…

- ”)%>
+ ”) %>

Also don’t post titles in ALL CAPS.

2 Likes