hi i am using ajax to post data to my db, but keep running into this error.
no function clause matching in SmartcomClientWeb.TemplateController.create/2
this is my is my ajax code
$("#push_data").click(function() {
params = $("form.form-temp").serialize();
$.ajax({
type: 'POST',
url: '/create/template',
data: params,
success: function (response) {
console.log(response)
},
error: function (error) {
console.log(error)
}
})
})
then this is my function
def create(conn, %{“template” => template_params}) do
case Templates.create_template(template_params) do
{:ok, template} ->
conn
|> put_flash(:info, “Template created successfully.”)
|> redirect(to: Routes.template_path(conn, :show, template))
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "new.html", changeset: changeset)
end
end