JSFiddle - React, Tailwind, and code Playground
HTML
<div id="bin">
<form class="add" method="post" action="/bin/add/">
<p>I'm interested! Save for later.</p>
<input type="hidden" name="product_id" value="23423">
<input type="submit" value="Save">
</form>
<form style="display:none;" class="remove" method="post" action="/bin/remove/">
<p>I changed my mind--I'm not interested.</p>
<input type="hidden" name="product_id" value="23423">
<input type="submit" value="Unsave">
</form>
</div>
JavaScript
$('#bin form').submit(function() {
$.post($(this).attr('action'), {
success: function(data) {
$(this).hide().siblings('form').show()
},
data: $(this).serialize()
});
return false;
})