Rather than start a new topic (unless you would prefer me to)
I too am struggling with setting a variable inside javascript.
I have a signature drawing in my database (JSON) e.g [{lx:20,ly:34,mx:20,my:34},{lx:21,ly:33,mx:20,my:34},…];
I return that value in serverconnnect and bind it to a variable
<dmx-value id="sig" dmx-bind:value="sig.value"></dmx-value>
If i place the variable on my page it shows the value correctly.
I then have this at the bottom within the body
<script type="text/javascript">
$(document).ready(function () {
$('.sigPad').signaturePad({displayOnly:true}).regenerate(sig);
});
</script>
I need to set a variable ‘sig’ to the value of my JSON signature
var sig = [{lx:20,ly:34,mx:20,my:34},{lx:21,ly:33,mx:20,my:34},…];
I’ve tried the suggestions about, but can’t seem to get it to work.
Many thanks in advance.
Mim