Sha256: d4a5d6f72892a4e6461581dfd0160c8bfd3bb2b7840457376a39e864a043ce71
Contents?: true
Size: 1.47 KB
Versions: 312
Compression:
Stored size: 1.47 KB
Contents
<form id="discounts"> <label for="gift-card" style="margin: 0 0 12px">Gift Card Number:</label> <input id="gift-card" name="gift_card_number" type="text" placeholder="<%= @invoice.discounts.first.code if @invoice.discounts.any? %>" maxlength="8" /> <div id="message"></div> <input id="back" type="button" value="< Back" onclick="window.location='/checkout/shipping'" /> <input id="next" type="submit" value="<%= if @invoice.discounts.any? then 'Update' else 'Add' end %>" /> <input id="skip" type="button" value="<%= if @invoice.discounts.any? then 'Continue >' else 'Skip >' end %>" onclick="window.location='/checkout/billing'" /> </form> <% content_for :caboose_js do %> <script> $(document).ready(function() { var $form = $('#discounts'); $form.on('submit', function(event) { event.preventDefault(); $.ajax({ url: '/checkout/discount', type: 'post', data: $form.serialize(), success: function(response) { console.log(response); if (response.success) { $('#next').empty().val('Update') $('#skip').empty().val('Continue >'); $('#message').removeClass('error').addClass('success'); } else { $('#message').removeClass('success').addClass('error'); } $('#message').empty().text(response.message); } }); }); }); </script> <% end %>
Version data entries
312 entries across 312 versions & 1 rubygems