I’ve used phx.gen.html to generate the boilerplate and added resources "/route", RouteController to the router.ex. I’m trying to insert a record into the database using create in the controller using a button inside another module.
At first I just had
conn
|> put_flash(:info, "Item added")
which returns
(Plug.Conn.NotSentError) a response was neither set nor sent from the connection
So I added
conn
|> put_flash(:info, "Item added")
|> send_resp(:ok, "Success")
but this is still undesired because it redirects me to a blank page /route?id=1 URL when this function gets called. I want to insert the record without changing the current page or even refreshing. I feel like I’m missing something fundamental but the phoenix plug and controller docs have not been sufficient, for me.
<%= button "Add", to: Routes.route_path(@conn, :create, id: id) %> is the button I’m using.






















