I tried to create and add a FAQ schema markup in my website, where data will be provided from Javascript variables value. But when I add it in my code, it not working.
Here’s my code:
<script>
var date = "17th April";
var month = 2024;
// N.B. Date and months will be update automatically time by time
</script>
<script type="application/ld+json">{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is today ?","acceptedAnswer":{"@type":"Answer","text":"Today is + date +"}},{"@type":"Question","name":"What is this year ?","acceptedAnswer":{"@type":"Answer","text":"This is + month +"}}]}
</script>
When I go to view page source or Inspect, I can see that there’s no change. Where is the problem and How can I fix it ?