javascript - If confirm in js.erb -
I want something to work like this:
Show.erb.js:
If (Confirm ('Delete the car?')) {& Lt;% @ current_cart.reset% & gt; $ ('Cartbase'). Replace ('& lt;% = j render: partial = & gt; "layout / cartbase"%> gt; } But the ARB part of code is always growing
Any ideas?
Because the code and lt;% @ current_cart.reset% & gt; will be executed when ERB means. If you use AJAX:
if (confirm ('delete cart?')) {$ .post ('& lt;% = reset_cart_path (@current_cart) )% & Gt; ', function () {$ (' .cartbadge '). Replacewith (' & lt;% = j render: partial = & gt; "layout / cartbase"%>;);}); }
Comments
Post a Comment