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.

28 lines
892 B

9 years ago
  1. $(function () {
  2. $(".btn-create-payment-method").click(function() {
  3. var planId = $(this).data("plan-id");
  4. $("#plan_id").val(planId);
  5. $.getJSON("/pricing/get_client_token/", function(data) {
  6. var $modal = $("#payment-method-modal");
  7. braintree.setup(data.client_token, "dropin", {
  8. container: "payment-form"
  9. });
  10. $modal.modal("show");
  11. })
  12. });
  13. $(".btn-update-payment-method").click(function() {
  14. $.getJSON("/pricing/get_client_token/", function(data) {
  15. var $modal = $("#update-payment-method-modal");
  16. braintree.setup(data.client_token, "dropin", {
  17. container: "update-payment-form"
  18. });
  19. $modal.modal("show");
  20. })
  21. });
  22. $(".pm-modal").on("hidden.bs.modal", function() {
  23. location.reload();
  24. })
  25. });