I have two or more widgets in one page with a remote call. For example:
<script async src="https://example.com/widget.js?cid=2" type="text/javascript"></script>
<div id="cid_2"></div>
<script async src="https://example.com/widget.js?cid=3" type="text/javascript"></script>
<div id="cid_3"></div>
Inside each widget.js
I need to take the cid
parameter, do some tasks inside the widget that need the cid
parameter and write the result on the corresponding <div>
(#cid_2
, #cid_3
etc).
How do I get the cid
value from the url (.js?cid=
) from inside widget.js
?