You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

9 years ago
9 years ago
  1. $(function () {
  2. var prices = [2, 5, 10, 15, 20, 25, 50, 100];
  3. var initialPrice = parseInt($("#pricing-value").text());
  4. var priceIdx = prices.indexOf(initialPrice);
  5. function updateDisplayPrice(price) {
  6. $("#pricing-value").text(price);
  7. $("#pww-switch-btn").text("Switch to $" + price + " / mo");
  8. if (price == initialPrice) {
  9. $("#pww-selected-btn").show();
  10. $("#pww-switch-btn").hide();
  11. } else {
  12. $("#pww-selected-btn").hide();
  13. $("#pww-switch-btn").show();
  14. }
  15. }
  16. $(".btn-create-payment-method").click(function() {
  17. var planId = $(this).data("plan-id");
  18. console.log(planId);
  19. $("#plan_id").val(planId);
  20. $.getJSON("/pricing/get_client_token/", function(data) {
  21. var $modal = $("#payment-method-modal");
  22. braintree.setup(data.client_token, "dropin", {
  23. container: "payment-form"
  24. });
  25. $modal.modal("show");
  26. })
  27. });
  28. $("#payment-method-cancel").click(function() {
  29. location.reload();
  30. });
  31. });