Hi Famous Mag, I tried but it didn’t generate the QR Code in the original function to generate the QRcode the information is data: “information” I believe that’s why it didn’t generate now, what would be the syntax? Thank you very much
I just said how you get a wappler variable inside javascript…
Now about not working, I see your script is just running on page load inside a script.
When this script has to be executed in order var1 to has a value?
Maybe you need to run it after the var1 has been evaluated , for example onsuccess of a serverconnect or whatever event gives the var1 a value
try to call this var1 value with an alert 1st thing inside your script to see if you get a value for var1 (obviously has no value yet at the time that the script is ececuted…)
I did a test by putting the value of the static variable to test, but even though it is static it does not generate the QR code only when I manually put it inside the quotation marks, maybe it is the library that generates the QR?
I did several tests with an example from Teodor, and even in this simple example it doesn’t show the variable log in the console, it’s very strange, could you test to see if this is my case?
I did this test:
<dmx-value id="var1" dmx-bind:value="'123'"></dmx-value>
<script>
function myFunction() {
var myVar = dmx.parse('var1.value');
console.log(myVar);
}
</script>
Did you make it work?
You were trying to assign a value to var1 that was coming from a serverconnect that hasn’t been successfull yet (means no value there).
Beside that I don’t see a reason for this to use a variable once you just need the value that comes from your serverconnect sc_pulseira.
All we did is take out the variable and run a javascript function ONCE the serverconnect is successfull and of course pass that value to the javascript fuction in ordre to be straight accessed inside your jacascript function without dmx.parse.
Now the function runs before the app connect components and their data are ready/available. You can run the function on ready event on the body tag onready="myFunction()" or run it on some button click etc.