I've run into a very strange issue that I'm having a tough time fixing. In my view, I have a link with data-remote="true"
and data-method="delete"
. When I click the link, I can see a DELETE
request to my rails server. The JS code returned then changes this link's properties, among which are the href
and data-method
.
Upon clicking this link again, my server is receiving a request to the new href
, but with the old data-method
, even though I have changed it from DELETE
to POST
(it still sends a DELETE
request).
If I refresh the page, however, the HTML is the same as the "new" HTML (changed with my returned JS), but it actually sends the right request type. This is why the issue is puzzling me.