I'm a coding novice, trying to learn! I have passed a query parameter into a JavaScript variable using the below:
const queryString = window.location.search;
console.log(queryString);
const urlParams = new URLSearchParams(queryString);
var name = urlParams.get('id')
And would now like to pass it into JSON, within the below div
<div
class="review-form"
data-site-uuid="xxxxxx"
data-form-uuid="xxxxxx"
data-prefill='{"firstName":name}'
></div>
Such that my parameter will ultimately populate on the review form.
Any help much appreciated!
I initially tried passing the JavaScript variable into the field before realising it was JSON.