diff --git a/united4earth/static/js/main.js b/united4earth/static/js/main.js index cae1a8e13101bb3a3b263594d4b51bedc7d7ae07..9597a1c0e1cb0361924b656a7b21e803aa4d904a 100644 --- a/united4earth/static/js/main.js +++ b/united4earth/static/js/main.js @@ -461,7 +461,8 @@ function checkFormValidity(formClickEvent,form) { Refresh Solid Display datasrc =*/ function refreshSolidDisplaySrc(form,displayId) { - //console.log("refreshing display, form",form,"display id ",displayId); + queryParameters = {'new':'?','add':'&'} + defaultQueryParameter = queryParameters['new'] //get source of the form let formSrc = form.dataset.src; //break it into URL in order to only select domain & uri for later on @@ -475,7 +476,7 @@ function refreshSolidDisplaySrc(form,displayId) { //make a URL of it const displaySourceUrl = new URL(displaySource); //refresh the source with reconstructed URL to + cache break - displayId.dataset.src = displaySourceUrl.origin + displaySourceUrl.pathname + "?" + Math.random(); + displayId.dataset.src = displaySourceUrl.origin + displaySourceUrl.pathname + defaultQueryParameter + Math.random(); } //if it's a representative form, refresh counter else if (form.id == "representative-email-form") { @@ -484,7 +485,10 @@ function refreshSolidDisplaySrc(form,displayId) { if (emailCounter) { setTimeout(() => { emailCounterDataSrc = emailCounter.dataset.src - emailCounter.dataset.src = emailCounterDataSrc + "?" + Math.random(); + if (emailCounterDataSrc.includes('?')) { + defaultQueryParameter = queryParameters['add'] + } + emailCounter.dataset.src = emailCounterDataSrc + defaultQueryParameter + Math.random(); }, 1500); } } @@ -502,7 +506,10 @@ function refreshSolidDisplaySrc(form,displayId) { //console.log("updating display url",formPath,sibDisplayPath); if (sibDisplayPath == formPath){ //if it does, refresh it - sibDisplay.dataset.src = formSrc + "?" + Math.random() ; + if (formSrc.includes('?')) { + defaultQueryParameter = queryParameters['add'] + } + sibDisplay.dataset.src = formSrc + defaultQueryParameter + Math.random() ; } } });