Passing query parameter from the URL into the javascript value
Hi ,
I need to pass the query parameter values from the search URL into the Java script value in AEM component. Using this URL as an example, https://www.xyz.com/content/test1/testpage/abc-def-xyz.3132.html?sort=&page=1, Value of the query parameter from the URL will be- 'abc def xyz'
Sample JS used in HTL:
<script type="text/javascript" charset="utf-8">
var pageOptions =
{ "query": "<search term>", // When the value of the Page field is Search, this value should be dynamically update the value with the value of query parameter in the URI while this is being loaded. }
;
</script>
So, could anyone please suggest me the ways to integrate dynamically the query param value in the custom javascript .
Thanks in Advance!