From 9f500681578fdf8917f597f95851a9ce1ba0ce99 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sat, 6 Feb 2021 20:13:32 -0700 Subject: [PATCH] Only load Stripe.js once --- www/assets/js/noticeslip.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/www/assets/js/noticeslip.js b/www/assets/js/noticeslip.js index dbac7fb..f4b8c08 100644 --- a/www/assets/js/noticeslip.js +++ b/www/assets/js/noticeslip.js @@ -7,6 +7,7 @@ var signaturePad = null; var frontSlipImg = null; var backSlipImg = null; +var stripeLoaded = false; function initSignaturePad() { var canvas = document.getElementById("signaturecanvas"); @@ -35,7 +36,11 @@ function initNoticeSlipForm() { initSignaturePad(); $("#noticeform #name").attr("placeholder", ["John Doe", "Jane Doe", "Dave S. Nothereman", "Sara N. Ignatur"].random()); $("#noticeform #zip").attr("placeholder", ["59601", "59602"].random()); - $.getScript("https://js.stripe.com/v3"); + if (!stripeLoaded) { + $.getScript("https://js.stripe.com/v3", function () { + stripeLoaded = true; + }); + } } function takeDocPhoto(side) {