刷新页面后会显示警报

时间:2022-09-15 08:48:05
 <%= link_to "Delete",(@article) ,method:"delete",data: { confirm: 'Are you sure you want to delete ?' } %>

I have a rails app which lets the user create an account, post, delete and update comments, and get notifications using rails and Jquery.

我有一个rails应用程序,它允许用户创建一个帐户,发布,删除和更新注释,并使用rails和Jquery获取通知。

When I click the buttons which include confirm messages do not work until I refresh the page. Why ? What should I do ?

单击包含确认消息的按钮在刷新页面之前不起作用。为什么?我该怎么办 ?

after removing the <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> from the application,It saves the updates directly without alerting useres

从应用程序中删除<%= javascript_include_tag'应用程序','data-turbolinks-track'=> true%>后,它直接保存更新而不提醒用户

1 个解决方案

#1


0  

can you try this:

你能试试这个:

<%= link_to 'Delete',url_for(action: :delete,id: @article.id),method: :delete, data: {confirm: "Are you sure?"} %>

#1


0  

can you try this:

你能试试这个:

<%= link_to 'Delete',url_for(action: :delete,id: @article.id),method: :delete, data: {confirm: "Are you sure?"} %>